[FFmpeg-cvslog] avformat/utils: Do not select audio streams with unknown sample rate in av_find_best_stream ()

Michael Niedermayer git at videolan.org
Sat Jun 6 01:12:33 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jun  6 00:55:12 2015 +0200| [42c41e96ff6dc4fa24d98e1913aff925b8122776] | committer: Michael Niedermayer

avformat/utils: Do not select audio streams with unknown sample rate in av_find_best_stream()

Together with the next commit this prevents non-PCM S302M from being selected unless either
it can be decoded or the user selects passthrough/copy

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

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

 libavformat/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index c07bae2..caa15ab 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3521,7 +3521,7 @@ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
             st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED |
                                AV_DISPOSITION_VISUAL_IMPAIRED))
             continue;
-        if (type == AVMEDIA_TYPE_AUDIO && !avctx->channels)
+        if (type == AVMEDIA_TYPE_AUDIO && !(avctx->channels && avctx->sample_rate))
             continue;
         if (decoder_ret) {
             decoder = find_decoder(ic, st, st->codec->codec_id);



More information about the ffmpeg-cvslog mailing list