diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-03-07 12:52:59 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-07 12:53:02 +0100 |
commit | d540e7577a4cfdb166d0287b619c30969ca749b4 (patch) | |
tree | 0f0f668d2e9d0a156cbf7ac4a1b22bbd053ed9db /libavformat/rtmppkt.c | |
parent | 774d0c9dbaf580df1570fb46caf5917e20ca5193 (diff) | |
parent | 5b2ad78f97d43299adcb038c04346999fe9b196c (diff) | |
download | ffmpeg-d540e7577a4cfdb166d0287b619c30969ca749b4.tar.gz |
Merge commit '5b2ad78f97d43299adcb038c04346999fe9b196c'
* commit '5b2ad78f97d43299adcb038c04346999fe9b196c':
rtmppkt: Handle extended timestamp field even for one-byte header
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtmppkt.c')
-rw-r--r-- | libavformat/rtmppkt.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index f99540cd51..3c99adcbf0 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -169,6 +169,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, uint8_t buf[16]; int channel_id, timestamp, size; + uint32_t ts_field; // non-extended timestamp or delta field uint32_t extra = 0; enum RTMPPacketType type; int written = 0; @@ -195,12 +196,12 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, hdr >>= 6; if (hdr == RTMP_PS_ONEBYTE) { - timestamp = prev_pkt[channel_id].ts_delta; + ts_field = prev_pkt[channel_id].ts_delta; } else { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; - timestamp = AV_RB24(buf); + ts_field = AV_RB24(buf); if (hdr != RTMP_PS_FOURBYTES) { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); @@ -217,11 +218,13 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, extra = AV_RL32(buf); } } - if (timestamp == 0xFFFFFF) { - if (ffurl_read_complete(h, buf, 4) != 4) - return AVERROR(EIO); - timestamp = AV_RB32(buf); - } + } + if (ts_field == 0xFFFFFF) { + if (ffurl_read_complete(h, buf, 4) != 4) + return AVERROR(EIO); + timestamp = AV_RB32(buf); + } else { + timestamp = ts_field; } if (hdr != RTMP_PS_TWELVEBYTES) timestamp += prev_pkt[channel_id].timestamp; @@ -232,8 +235,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, return ret; p->read = written; p->offset = 0; - prev_pkt[channel_id].ts_delta = timestamp - - prev_pkt[channel_id].timestamp; + prev_pkt[channel_id].ts_delta = ts_field; prev_pkt[channel_id].timestamp = timestamp; } else { // previous packet in this channel hasn't completed reading |