rtmpproto: Send a full, absolute timestamp if it isn't monotonically growing
authorMartin Storsjö <martin@martin.st>
Fri, 17 Jan 2014 12:30:57 +0000 (14:30 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 20 Jan 2014 19:57:02 +0000 (21:57 +0200)
The normal differential timestamps can't handle negative
differences, thus send a full packet header with an absolute
timestamp in these cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtmppkt.c

index f58f668..81621b1 100644 (file)
@@ -313,7 +313,8 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
 
     //if channel_id = 0, this is first presentation of prev_pkt, send full hdr.
     if (prev_pkt[pkt->channel_id].channel_id &&
 
     //if channel_id = 0, this is first presentation of prev_pkt, send full hdr.
     if (prev_pkt[pkt->channel_id].channel_id &&
-        pkt->extra == prev_pkt[pkt->channel_id].extra) {
+        pkt->extra == prev_pkt[pkt->channel_id].extra &&
+        pkt->timestamp >= prev_pkt[pkt->channel_id].timestamp) {
         if (pkt->type == prev_pkt[pkt->channel_id].type &&
             pkt->size == prev_pkt[pkt->channel_id].size) {
             mode = RTMP_PS_FOURBYTES;
         if (pkt->type == prev_pkt[pkt->channel_id].type &&
             pkt->size == prev_pkt[pkt->channel_id].size) {
             mode = RTMP_PS_FOURBYTES;