[SCM] libav/experimental: Full-header RTMP packets contain real timestamp, others contain timestamp difference, so make all read packets store absolute timestamp. As a consequence, we don't need to track audio/video timestamps separately any longer in protocol handler.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:55:16 UTC 2013


The following commit has been merged in the experimental branch:
commit e6b244a3b986e513779aec83beab4fb25a130aa2
Author: Kostya Shishkov <kostya.shishkov at gmail.com>
Date:   Tue Dec 1 16:08:44 2009 +0000

    Full-header RTMP packets contain real timestamp, others contain timestamp
    difference, so make all read packets store absolute timestamp.
    As a consequence, we don't need to track audio/video timestamps separately
    any longer in protocol handler.
    
    Originally committed as revision 20685 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 6c2e2f5..37846e3 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -116,6 +116,8 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
                 return AVERROR(EIO);
             timestamp = AV_RB32(buf);
         }
+        if (hdr != RTMP_PS_TWELVEBYTES)
+            timestamp += prev_pkt[channel_id].timestamp;
     }
     if (ff_rtmp_packet_create(p, channel_id, type, timestamp, data_size))
         return -1;
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 7b4f9eb..8148fbf 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -63,8 +63,6 @@ typedef struct RTMPContext {
     uint8_t*      flv_data;                   ///< buffer with data for demuxer
     int           flv_size;                   ///< current buffer size
     int           flv_off;                    ///< number of bytes read from current buffer
-    uint32_t      video_ts;                   ///< current video timestamp in milliseconds
-    uint32_t      audio_ts;                   ///< current audio timestamp in milliseconds
 } RTMPContext;
 
 #define PLAYER_KEY_OPEN_PART_LEN 30   ///< length of partial key used for first client digest signing
@@ -515,13 +513,6 @@ static int get_packet(URLContext *s, int for_header)
             uint8_t *p;
             uint32_t ts = rpkt.timestamp;
 
-            if (rpkt.type == RTMP_PT_VIDEO) {
-                rt->video_ts += rpkt.timestamp;
-                ts = rt->video_ts;
-            } else if (rpkt.type == RTMP_PT_AUDIO) {
-                rt->audio_ts += rpkt.timestamp;
-                ts = rt->audio_ts;
-            }
             // generate packet header and put data into buffer for FLV demuxer
             rt->flv_off  = 0;
             rt->flv_size = rpkt.data_size + 15;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list