[FFmpeg-cvslog] ffmpeg: Do av_buffersink_set_frame_size() when reconfiguring the filtergraph not just when changing audio resample parameters

Michael Niedermayer git at videolan.org
Fri Oct 3 03:47:47 CEST 2014


ffmpeg | branch: release/2.3 | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 11 04:55:58 2014 +0200| [9c57328b8192982b0c394ff5fd45a0b6863efbfd] | committer: Michael Niedermayer

ffmpeg: Do av_buffersink_set_frame_size() when reconfiguring the filtergraph not just when changing audio resample parameters

Fixes Ticket3562

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 16de4d927e8bd1308694217af6027265700b3694)

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

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

 ffmpeg.c        |    8 --------
 ffmpeg_filter.c |   10 ++++++++++
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 0dcdcfd..3015ca8 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1799,18 +1799,10 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
         for (i = 0; i < nb_filtergraphs; i++)
             if (ist_in_filtergraph(filtergraphs[i], ist)) {
                 FilterGraph *fg = filtergraphs[i];
-                int j;
                 if (configure_filtergraph(fg) < 0) {
                     av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
                     exit_program(1);
                 }
-                for (j = 0; j < fg->nb_outputs; j++) {
-                    OutputStream *ost = fg->outputs[j]->ost;
-                    if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
-                        !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
-                        av_buffersink_set_frame_size(ost->filter->filter,
-                                                     ost->enc_ctx->frame_size);
-                }
             }
     }
 
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 50ee422..7b75e6f 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -919,6 +919,16 @@ int configure_filtergraph(FilterGraph *fg)
     }
 
     fg->reconfiguration = 1;
+
+    for (i = 0; i < fg->nb_outputs; i++) {
+        OutputStream *ost = fg->outputs[i]->ost;
+        if (ost &&
+            ost->enc->type == AVMEDIA_TYPE_AUDIO &&
+            !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
+            av_buffersink_set_frame_size(ost->filter->filter,
+                                         ost->enc_ctx->frame_size);
+    }
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list