[FFmpeg-cvslog] avformat/mux: ignore delayed vp8/ 9 packets in max_interleave_delta calculation

Michael Niedermayer git at videolan.org
Sat Jul 26 01:16:37 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jul 26 00:56:32 2014 +0200| [a06fac353ce2bd055f920e7f6f5e2145736d2d2c] | committer: Michael Niedermayer

avformat/mux: ignore delayed vp8/9 packets in max_interleave_delta calculation

libvpx adds very significant delay, which appears normal and we must
buffer all other streams no matter what to interleave them correctly

Fixes Ticket3440

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mux.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index bd9f7e5..b264ce0 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -778,7 +778,9 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
     for (i = 0; i < s->nb_streams; i++) {
         if (s->streams[i]->last_in_packet_buffer) {
             ++stream_count;
-        } else if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+        } else if (s->streams[i]->codec->codec_type != AVMEDIA_TYPE_ATTACHMENT &&
+                   s->streams[i]->codec->codec_id != AV_CODEC_ID_VP8 &&
+                   s->streams[i]->codec->codec_id != AV_CODEC_ID_VP9) {
             ++noninterleaved_count;
         }
     }
@@ -786,7 +788,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
     if (s->internal->nb_interleaved_streams == stream_count)
         flush = 1;
 
-    if (s->max_interleave_delta > 0 && s->packet_buffer && !flush) {
+    if (s->max_interleave_delta > 0 &&
+        s->packet_buffer &&
+        !flush &&
+        s->internal->nb_interleaved_streams == stream_count+noninterleaved_count
+    ) {
         AVPacket *top_pkt = &s->packet_buffer->pkt;
         int64_t delta_dts = INT64_MIN;
         int64_t top_dts = av_rescale_q(top_pkt->dts,



More information about the ffmpeg-cvslog mailing list