Commit 896e5975 authored by Reimar Döffinger's avatar Reimar Döffinger

Move resetting of channels, sample_rate back to av_find_stream_info.

Resetting it on codec init would incorrectly clear the values
if av_find_stream_info was already run before, in particular
breaking ffplay.

This fixes trac tickets #213 and #262.
Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent 45ecc7a2
...@@ -570,9 +570,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ...@@ -570,9 +570,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
ac->m4ac.sample_rate = avctx->sample_rate; ac->m4ac.sample_rate = avctx->sample_rate;
if (avctx->extradata_size > 0) { if (avctx->extradata_size > 0) {
avctx->channels = 0;
avctx->frame_size = 0;
avctx->sample_rate = 0;
if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac, if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
avctx->extradata, avctx->extradata,
avctx->extradata_size) < 0) avctx->extradata_size) < 0)
......
...@@ -2261,6 +2261,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) ...@@ -2261,6 +2261,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
for(i=0;i<ic->nb_streams;i++) { for(i=0;i<ic->nb_streams;i++) {
AVCodec *codec; AVCodec *codec;
st = ic->streams[i]; st = ic->streams[i];
if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size) {
// We need to discard these since they can be plain wrong for
// backwards compatible HE-AAC signaling.
// But when we have no extradata we need to keep them or we can't
// play anything at all.
st->codec->sample_rate = 0;
st->codec->frame_size = 0;
st->codec->channels = 0;
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment