[FFmpeg-cvslog] avformat/mpegenc: Better heuristic for ordering packets

Michael Niedermayer git at videolan.org
Thu Sep 26 03:28:50 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 26 03:13:38 2013 +0200| [32cde962969363bebc4ad49b770ffff39487d3f8] | committer: Michael Niedermayer

avformat/mpegenc: Better heuristic for ordering packets

This prevents underflows in quite constrained cases

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

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

 libavformat/mpegenc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 47a7ced..811fe2d 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -955,7 +955,9 @@ retry:
 
         if(next_pkt && next_pkt->dts - scr > max_delay)
             continue;
-
+        if (   stream->predecode_packet
+            && stream->predecode_packet->size > stream->buffer_index)
+            rel_space += 1<<28;
         if(rel_space > best_score){
             best_score= rel_space;
             best_i = i;



More information about the ffmpeg-cvslog mailing list