diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-07-29 15:13:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-29 15:13:00 +0200 |
commit | 6c56980cbeecaaeac0367ad9aa48eaa84fd8314b (patch) | |
tree | 062e0fa2e0ecf1a3072386972a87886fa38fe3ec /src/h264.c | |
parent | 5d297b1594765b681466b13257af0a59bf765ff8 (diff) |
Video timestamp (#286)
* add timestamp to video encoder/decoder
* update vp8 vp9
* random offset
* revert decoder timestamp
* cleanup
* gst_video1: add timestamp
* change timestamp to RTP-timestamp
* update modules
* timestamp things
* save rtp timestamp
* packet_handler: align params same as RTP header
* align parameters same way like RTP-header
* avcodec: calc ts for old FFmpeg versions
* cleanup
* fix gst
avcodec: use correct AVPacket
* minor cleanup
Diffstat (limited to 'src/h264.c')
-rw-r--r-- | src/h264.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -103,23 +103,24 @@ 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, + const uint8_t *buf, size_t sz, + bool eof, uint32_t rtp_ts, videnc_packet_h *pkth, void *arg) { - return pkth(eof, hdr, hdr_sz, buf, sz, arg); + return pkth(eof, rtp_ts, hdr, hdr_sz, buf, sz, arg); } int h264_nal_send(bool first, bool last, - bool marker, uint32_t ihdr, const uint8_t *buf, - size_t size, size_t maxsz, + bool marker, uint32_t ihdr, uint32_t rtp_ts, + const uint8_t *buf, size_t size, size_t maxsz, videnc_packet_h *pkth, void *arg) { uint8_t hdr = (uint8_t)ihdr; int err = 0; if (first && last && size <= maxsz) { - err = rtp_send_data(&hdr, 1, buf, size, marker, + err = rtp_send_data(&hdr, 1, buf, size, marker, rtp_ts, pkth, arg); } else { @@ -133,6 +134,7 @@ int h264_nal_send(bool first, bool last, while (size > sz) { err |= rtp_send_data(fu_hdr, 2, buf, sz, false, + rtp_ts, pkth, arg); buf += sz; size -= sz; @@ -143,6 +145,7 @@ int h264_nal_send(bool first, bool last, fu_hdr[1] |= 1<<6; /* end bit */ err |= rtp_send_data(fu_hdr, 2, buf, size, marker && last, + rtp_ts, pkth, arg); } @@ -150,8 +153,8 @@ int h264_nal_send(bool first, bool last, } -int h264_packetize(const uint8_t *buf, size_t len, size_t pktsize, - videnc_packet_h *pkth, void *arg) +int h264_packetize(uint32_t rtp_ts, const uint8_t *buf, size_t len, + size_t pktsize, videnc_packet_h *pkth, void *arg) { const uint8_t *start = buf; const uint8_t *end = buf + len; @@ -170,7 +173,7 @@ int h264_packetize(const uint8_t *buf, size_t len, size_t pktsize, r1 = h264_find_startcode(r, end); err |= h264_nal_send(true, true, (r1 >= end), r[0], - r+1, r1-r-1, pktsize, + rtp_ts, r+1, r1-r-1, pktsize, pkth, arg); r = r1; } |