History

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.

Reimar Döffinger committed 15 years ago

Commit 896e5971 parent 45ecc7a2 files · +9 −3Browse files

Unified · Split

2 files
  1. libavcodec/aacdec.c +0 −3
  2. libavformat/utils.c +9 −0
libavcodec/aacdec.c+0−3
@@ -570,9 +570,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) · 569 unmodified lines
570570 ac->m4ac.sample_rate = avctx->sample_rate;
571571
572572 if (avctx->extradata_size > 0) {
573− avctx->channels = 0;
574− avctx->frame_size = 0;
575− avctx->sample_rate = 0;
576573 if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
577574 avctx->extradata,
578575 avctx->extradata_size) < 0)
libavformat/utils.c+9−0
@@ -2261,6 +2261,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) · 2260 unmodified lines
22612261 for(i=0;i<ic->nb_streams;i++) {
22622262 AVCodec *codec;
22632263 st = ic->streams[i];
2264+ if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size) {
2265+ // We need to discard these since they can be plain wrong for
2266+ // backwards compatible HE-AAC signaling.
2267+ // But when we have no extradata we need to keep them or we can't
2268+ // play anything at all.
2269+ st->codec->sample_rate = 0;
2270+ st->codec->frame_size = 0;
2271+ st->codec->channels = 0;
2272+ }
22642273
22652274 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
22662275 st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t