[vlc-commits] demux: avformat: workaround AAC in FLV incorrect timestamps (fix #8195)

Francois Cartegnie git at videolan.org
Fri Feb 24 11:30:27 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 24 11:15:13 2017 +0100| [30441c111dc0fc9964c9ee3fdfbee0ded23dc484] | committer: Francois Cartegnie

demux: avformat: workaround AAC in FLV incorrect timestamps (fix #8195)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30441c111dc0fc9964c9ee3fdfbee0ded23dc484
---

 modules/demux/avformat/demux.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index ff2bf5d..4824215 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -817,6 +817,18 @@ static int Demux( demux_t *p_demux )
         if( p_stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
             pkt.dts != (int64_t)AV_NOPTS_VALUE && pkt.dts == pkt.pts )
                 p_frame->i_pts = VLC_TS_INVALID;
+
+        /* Handle broken dts/pts increase with AAC. Duration is correct.
+         * sky_the80s_aacplus.flv #8195 */
+        if( p_stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
+            p_stream->codecpar->codec_id == AV_CODEC_ID_AAC )
+        {
+            if( p_sys->tk_pcr[pkt.stream_index] != VLC_TS_INVALID &&
+                p_sys->tk_pcr[pkt.stream_index] + p_frame->i_length > p_frame->i_dts )
+            {
+                p_frame->i_dts = p_frame->i_pts = p_sys->tk_pcr[pkt.stream_index] + p_frame->i_length;
+            }
+        }
     }
 #ifdef AVFORMAT_DEBUG
     msg_Dbg( p_demux, "tk[%d] dts=%"PRId64" pts=%"PRId64,



More information about the vlc-commits mailing list