aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-10-27 20:37:34 -0700
committerRonald S. Bultje <rsbultje@gmail.com>2011-10-28 23:42:57 -0700
commit38a4be3fa7a7bb83f0a553577427e916a7bda390 (patch)
tree7e3ea76dfc4dfcc5bf09870a7e7f0c8b82a0cfda
parent640d5f1c801061844394813c78ea449e5826f6e5 (diff)
downloadffmpeg-38a4be3fa7a7bb83f0a553577427e916a7bda390.tar.gz
lavf: use number of output pictures for delay checks.
This fixes false positives of has_codec_delay_been_guessed() for streams where not every input picture generates an output picture, such as interlaced H264.
-rw-r--r--libavformat/avformat.h1
-rw-r--r--libavformat/utils.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d16be90c8f..dd40c7fafb 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -657,6 +657,7 @@ typedef struct AVStream {
int duration_count;
double duration_error[MAX_STD_TIMEBASES];
int64_t codec_info_duration;
+ int nb_decoded_frames;
} *info;
#if !FF_API_REORDER_PRIVATE
const uint8_t *cur_ptr;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 81eee97a84..1158079992 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2119,7 +2119,7 @@ static int has_codec_parameters(AVCodecContext *avctx)
static int has_decode_delay_been_guessed(AVStream *st)
{
return st->codec->codec_id != CODEC_ID_H264 ||
- st->codec_info_nb_frames >= 6 + st->codec->has_b_frames;
+ st->info->nb_decoded_frames >= 6;
}
static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **options)
@@ -2145,6 +2145,8 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
avcodec_get_frame_defaults(&picture);
ret = avcodec_decode_video2(st->codec, &picture,
&got_picture, avpkt);
+ if (got_picture)
+ st->info->nb_decoded_frames++;
break;
case AVMEDIA_TYPE_AUDIO:
data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE);