summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2011-07-12 15:13:29 -0700
committerAlex Converse <alex.converse@gmail.com>2011-07-13 10:39:06 -0700
commita58858d60d37c7abfcea11bb387909bf9cd4916d (patch)
treec945ca41d93cb8fcf504e78b9d79a1a7e18dbab8
parent71a1d1116fd952f348d732c19ba7f4ebe041ce26 (diff)
lavf: Cleanup try_decode_frame() logic.
This fixes AAC playback in ffplay.
-rw-r--r--libavcodec/aacdec.c3
-rw-r--r--libavformat/utils.c9
2 files changed, 3 insertions, 9 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index f26a4b74a7..dac85c229d 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -568,9 +568,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
ac->m4ac.sample_rate = avctx->sample_rate;
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,
avctx->extradata,
avctx->extradata_size) < 0)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7e79922439..e738dba44a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2090,7 +2090,8 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
return ret;
}
- if(!has_codec_parameters(st->codec) || !has_decode_delay_been_guessed(st)){
+ if(!has_codec_parameters(st->codec) || !has_decode_delay_been_guessed(st) ||
+ (!st->codec_info_nb_frames && st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF)) {
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
avcodec_get_frame_defaults(&picture);
@@ -2387,11 +2388,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
least one frame of codec data, this makes sure the codec initializes
the channel configuration and does not only trust the values from the container.
*/
- if (!has_codec_parameters(st->codec) ||
- !has_decode_delay_been_guessed(st) ||
- (st->codec->codec &&
- st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF))
- try_decode_frame(st, pkt, (options && i <= orig_nb_streams )? &options[i] : NULL);
+ try_decode_frame(st, pkt, (options && i <= orig_nb_streams )? &options[i] : NULL);
st->codec_info_nb_frames++;
count++;