aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2009-12-01 16:43:53 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2009-12-01 16:43:53 +0000
commit817d967d96995ac63b4f74101768b29b6da5aece (patch)
tree6bfe0afddab3949de11043e1129e83eaae096bb2
parente6b244a3b986e513779aec83beab4fb25a130aa2 (diff)
downloadffmpeg-817d967d96995ac63b4f74101768b29b6da5aece.tar.gz
Write timestamp deltas, not timestamps, for RTMP packets with partial header
Originally committed as revision 20686 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/rtmppkt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 37846e3cea..b48493ba11 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -163,15 +163,18 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
bytestream_put_le16(&p, pkt->channel_id - 64);
}
if (mode != RTMP_PS_ONEBYTE) {
- bytestream_put_be24(&p, pkt->timestamp >= 0xFFFFFF ? 0xFFFFFF : pkt->timestamp);
+ uint32_t timestamp = pkt->timestamp;
+ if (mode != RTMP_PS_TWELVEBYTES)
+ timestamp -= prev_pkt[pkt->channel_id].timestamp;
+ bytestream_put_be24(&p, timestamp >= 0xFFFFFF ? 0xFFFFFF : timestamp);
if (mode != RTMP_PS_FOURBYTES) {
bytestream_put_be24(&p, pkt->data_size);
bytestream_put_byte(&p, pkt->type);
if (mode == RTMP_PS_TWELVEBYTES)
bytestream_put_le32(&p, pkt->extra);
}
- if (pkt->timestamp >= 0xFFFFFF)
- bytestream_put_be32(&p, pkt->timestamp);
+ if (timestamp >= 0xFFFFFF)
+ bytestream_put_be32(&p, timestamp);
}
url_write(h, pkt_hdr, p-pkt_hdr);
while (off < pkt->data_size) {