avformat/utils: Do not select audio streams with unknown sample rate in av_find_best_...
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Jun 2015 22:55:12 +0000 (00:55 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Jun 2015 23:02:43 +0000 (01:02 +0200)
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@gmx.at>
libavformat/utils.c

index c07bae2..caa15ab 100644 (file)
@@ -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);