---
 fftools/ffplay.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 4ea48e11bb..ef45f12906 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2702,6 +2702,7 @@ static int stream_component_open(VideoState *is, int 
stream_index)
     case AVMEDIA_TYPE_AUDIO:
         {
             AVFilterContext *sink;
+            AVFrame *params = NULL;
 
             is->audio_filter_src.freq           = avctx->sample_rate;
             ret = av_channel_layout_copy(&is->audio_filter_src.ch_layout, 
&avctx->ch_layout);
@@ -2711,10 +2712,23 @@ static int stream_component_open(VideoState *is, int 
stream_index)
             if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
                 goto fail;
             sink = is->out_audio_filter;
-            sample_rate    = av_buffersink_get_sample_rate(sink);
-            ret = av_buffersink_get_ch_layout(sink, &ch_layout);
-            if (ret < 0)
+
+            params = av_frame_alloc();
+            if (!params) {
+                ret = AVERROR(ENOMEM);
                 goto fail;
+            }
+
+            ret = av_buffersink_get_frame_flags(sink, params, 
AV_BUFFERSINK_FLAG_PARAMS);
+            if (ret < 0) {
+                av_frame_free(&params);
+                goto fail;
+            }
+
+            sample_rate = params->sample_rate;
+            FFSWAP(AVChannelLayout, ch_layout, params->ch_layout);
+
+            av_frame_free(&params);
         }
 
         /* prepare audio output */
-- 
2.43.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to