It seems it is more secure to simply duplicate the computing routine from compute_pkt_fields to estimate_timings_from_pts.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
{
AVPacket pkt1, *pkt = &pkt1;
AVStream *st;
{
AVPacket pkt1, *pkt = &pkt1;
AVStream *st;
+ int num, den, read_size, i, ret;
int found_duration = 0;
int is_end;
int64_t filesize, offset, duration;
int found_duration = 0;
int is_end;
int64_t filesize, offset, duration;
if (pkt->pts != AV_NOPTS_VALUE &&
(st->start_time != AV_NOPTS_VALUE ||
st->first_dts != AV_NOPTS_VALUE)) {
if (pkt->pts != AV_NOPTS_VALUE &&
(st->start_time != AV_NOPTS_VALUE ||
st->first_dts != AV_NOPTS_VALUE)) {
+ if (pkt->duration == 0) {
+ ff_compute_frame_duration(&num, &den, st, st->parser, pkt);
+ if (den && num) {
+ pkt->duration = av_rescale_rnd(1,
+ num * (int64_t) st->time_base.den,
+ den * (int64_t) st->time_base.num,
+ AV_ROUND_DOWN);
+ }
+ }
duration = pkt->pts + pkt->duration;
found_duration = 1;
if (st->start_time != AV_NOPTS_VALUE)
duration = pkt->pts + pkt->duration;
found_duration = 1;
if (st->start_time != AV_NOPTS_VALUE)