You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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.
This commit is contained in:
@@ -657,6 +657,7 @@ typedef struct AVStream {
|
|||||||
int duration_count;
|
int duration_count;
|
||||||
double duration_error[MAX_STD_TIMEBASES];
|
double duration_error[MAX_STD_TIMEBASES];
|
||||||
int64_t codec_info_duration;
|
int64_t codec_info_duration;
|
||||||
|
int nb_decoded_frames;
|
||||||
} *info;
|
} *info;
|
||||||
#if !FF_API_REORDER_PRIVATE
|
#if !FF_API_REORDER_PRIVATE
|
||||||
const uint8_t *cur_ptr;
|
const uint8_t *cur_ptr;
|
||||||
|
@@ -2119,7 +2119,7 @@ static int has_codec_parameters(AVCodecContext *avctx)
|
|||||||
static int has_decode_delay_been_guessed(AVStream *st)
|
static int has_decode_delay_been_guessed(AVStream *st)
|
||||||
{
|
{
|
||||||
return st->codec->codec_id != CODEC_ID_H264 ||
|
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)
|
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);
|
avcodec_get_frame_defaults(&picture);
|
||||||
ret = avcodec_decode_video2(st->codec, &picture,
|
ret = avcodec_decode_video2(st->codec, &picture,
|
||||||
&got_picture, avpkt);
|
&got_picture, avpkt);
|
||||||
|
if (got_picture)
|
||||||
|
st->info->nb_decoded_frames++;
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||||
|
Reference in New Issue
Block a user