[SCM] libav/experimental: Do not crash on frame size changes. Fixes issue1481.

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


The following commit has been merged in the experimental branch:
commit b83ccbffe9b109fcd18dbd178d6b4f300e6d6799
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Fri Dec 4 16:20:00 2009 +0000

    Do not crash on frame size changes.
    Fixes issue1481.
    
    Originally committed as revision 20730 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/ffmpeg.c b/ffmpeg.c
index d3a90cc..061d65b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -941,6 +941,15 @@ static void do_video_out(AVFormatContext *s,
         }
     }
 
+    if(    (ost->resample_height != (ist->st->codec->height - (ost->topBand  + ost->bottomBand)))
+        || (ost->resample_width  != (ist->st->codec->width  - (ost->leftBand + ost->rightBand)))
+        || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
+
+        fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width,     ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
+        if(!ost->video_resample)
+            av_exit(1);
+    }
+
     if (ost->video_resample) {
         padding_src = NULL;
         final_picture = &ost->pict_tmp;
@@ -948,7 +957,6 @@ static void do_video_out(AVFormatContext *s,
           || (ost->resample_width  != (ist->st->codec->width  - (ost->leftBand + ost->rightBand)))
           || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
 
-            fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
             /* keep bands proportional to the frame size */
             topBand    = ((int64_t)ist->st->codec->height * ost->original_topBand    / ost->original_height) & ~1;
             bottomBand = ((int64_t)ist->st->codec->height * ost->original_bottomBand / ost->original_height) & ~1;
@@ -1940,11 +1948,11 @@ static int av_encode(AVFormatContext **output_files,
                     ost->original_height = icodec->height;
                     ost->original_width  = icodec->width;
 
-                    ost->resample_height = icodec->height - (frame_topBand  + frame_bottomBand);
-                    ost->resample_width  = icodec->width  - (frame_leftBand + frame_rightBand);
-                    ost->resample_pix_fmt= icodec->pix_fmt;
                     codec->bits_per_raw_sample= 0;
                 }
+                ost->resample_height = icodec->height - (frame_topBand  + frame_bottomBand);
+                ost->resample_width  = icodec->width  - (frame_leftBand + frame_rightBand);
+                ost->resample_pix_fmt= icodec->pix_fmt;
                 ost->encoding_needed = 1;
                 ist->decoding_needed = 1;
                 break;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list