[FFmpeg-cvslog] rtmppkt: Repeat the full 32 bit timestamp for chunking continuation packets

Martin Storsjö git at videolan.org
Thu Jan 15 15:06:49 CET 2015


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Jan 14 23:09:06 2015 +0200| [024e5a2d5ff8a94adce48abb15ce2fb471f9d18e] | committer: Martin Storsjö

rtmppkt: Repeat the full 32 bit timestamp for chunking continuation packets

This fixes sending chunked packets (packets larger than the output
chunk size, which often can be e.g. 4096 bytes) with a timestamp delta
(or absolute timstamp, if it's a timestamp step backwards, or the
first packet of the stream) larger than 0xffffffff.

The RTMP spec explicitly says (in section 5.3.1.3.) that packets of
type 3 (continuation packets) should include this field, if the
previous non-continuation packet had it included.

The receiving code handles these packets correctly.

Pointed out by Cheolho Park.

CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=024e5a2d5ff8a94adce48abb15ce2fb471f9d18e
---

 libavformat/rtmppkt.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index e952091..f8c51d0 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -386,6 +386,13 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
             if ((ret = ffurl_write(h, &marker, 1)) < 0)
                 return ret;
             written++;
+            if (pkt->ts_field == 0xFFFFFF) {
+                uint8_t ts_header[4];
+                AV_WB32(ts_header, timestamp);
+                if ((ret = ffurl_write(h, ts_header, 4)) < 0)
+                    return ret;
+                written += 4;
+            }
         }
     }
     return written;



More information about the ffmpeg-cvslog mailing list