Skip to content

Commit f62d349

Browse files
committed
upipe_avcdec: fix video frame duration
frame->duration comes from pkt->duration which might be a field or a frame depending on the pic structure, so it cannot be used reliably for now.
1 parent 5e83855 commit f62d349

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

lib/upipe-av/upipe_avcodec_decode.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,18 +1355,8 @@ static void upipe_avcdec_output_pic(struct upipe *upipe, struct upump **upump_p)
13551355
uint64_t duration = 0;
13561356
AVRational uclock_time_base = av_make_q(1, UCLOCK_FREQ);
13571357

1358-
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 30, 100)
1359-
if (frame->duration) {
1360-
AVRational time_base = frame->time_base;
1361-
if (!time_base.num || !time_base.den)
1362-
time_base = context->pkt_timebase;
1363-
duration = av_rescale_q(frame->duration, time_base, uclock_time_base);
1364-
}
1365-
#endif
1366-
1367-
if (!duration && context->framerate.num && context->framerate.den) {
1368-
AVRational time_base = av_make_q(context->framerate.den,
1369-
context->framerate.num);
1358+
if (context->framerate.num && context->framerate.den) {
1359+
AVRational time_base = av_inv_q(context->framerate);
13701360
duration = av_rescale_q(1, time_base, uclock_time_base);
13711361
}
13721362

0 commit comments

Comments
 (0)