diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2018-02-24 19:11:22 +0100 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2018-02-24 19:11:22 +0100 |
commit | 59d29c0254b9240a00ac9236cc8e92c0ae65ec8a (patch) | |
tree | 86173746d71a3737e649ce41ce39f4bd56f1adc6 /src | |
parent | 73f6d3e5c86244d468499d17321fd9abfc65b9f0 (diff) |
vidcodec: change rtp_ts from 32-bit to 64-bit
the extended RTP timestamp from the video encoder
should now contain a full extended timestamp, that
must never wrap.
Diffstat (limited to 'src')
-rw-r--r-- | src/h264.c | 6 | ||||
-rw-r--r-- | src/vidutil.c | 16 |
2 files changed, 11 insertions, 11 deletions
@@ -104,7 +104,7 @@ const uint8_t *h264_find_startcode(const uint8_t *p, const uint8_t *end) static int rtp_send_data(const uint8_t *hdr, size_t hdr_sz, const uint8_t *buf, size_t sz, - bool eof, uint32_t rtp_ts, + bool eof, uint64_t rtp_ts, videnc_packet_h *pkth, void *arg) { return pkth(eof, rtp_ts, hdr, hdr_sz, buf, sz, arg); @@ -112,7 +112,7 @@ static int rtp_send_data(const uint8_t *hdr, size_t hdr_sz, int h264_nal_send(bool first, bool last, - bool marker, uint32_t ihdr, uint32_t rtp_ts, + bool marker, uint32_t ihdr, uint64_t rtp_ts, const uint8_t *buf, size_t size, size_t maxsz, videnc_packet_h *pkth, void *arg) { @@ -153,7 +153,7 @@ int h264_nal_send(bool first, bool last, } -int h264_packetize(uint32_t rtp_ts, const uint8_t *buf, size_t len, +int h264_packetize(uint64_t rtp_ts, const uint8_t *buf, size_t len, size_t pktsize, videnc_packet_h *pkth, void *arg) { const uint8_t *start = buf; diff --git a/src/vidutil.c b/src/vidutil.c index 9057688..26d17eb 100644 --- a/src/vidutil.c +++ b/src/vidutil.c @@ -14,23 +14,23 @@ * Calculate the RTP timestamp from Presentation Time Stamp (PTS) * or Decoding Time Stamp (DTS) and framerate. * - * @note The calculated RTP Timestamp may wrap around. + * @note The calculated RTP Timestamp may NOT wrap around. * * @param pts Presentation Time Stamp (PTS) * @param fps Framerate in [frames per second] * - * @return RTP Timestamp + * @return Extended RTP Timestamp */ -uint32_t video_calc_rtp_timestamp(int64_t pts, unsigned fps) +uint64_t video_calc_rtp_timestamp(int64_t pts, unsigned fps) { - uint64_t rtp_ts; + uint64_t rtp_ts; - if (!fps) - return 0; + if (!fps) + return 0; - rtp_ts = ((uint64_t)VIDEO_SRATE * pts) / fps; + rtp_ts = ((uint64_t)VIDEO_SRATE * pts) / fps; - return (uint32_t)rtp_ts; + return rtp_ts; } |