demux_lavf: fix timebase confusion

This set last_pts to bogus values, which is used for relative seeks.
The player usually uses absolute seeks, so this didn't matter much.
This commit is contained in:
wm4 2013-12-12 23:36:52 +01:00
parent 49f9291164
commit e66e16e691
1 changed files with 7 additions and 7 deletions

View File

@ -709,15 +709,10 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
dp = new_demux_packet_fromdata(pkt->data, pkt->size);
dp->avpacket = talloc_steal(dp, pkt);
if (pkt->pts != AV_NOPTS_VALUE) {
if (pkt->pts != AV_NOPTS_VALUE)
dp->pts = pkt->pts * av_q2d(st->time_base);
priv->last_pts = dp->pts;
}
if (pkt->dts != AV_NOPTS_VALUE) {
if (pkt->dts != AV_NOPTS_VALUE)
dp->dts = pkt->dts * av_q2d(st->time_base);
if (priv->last_pts == AV_NOPTS_VALUE)
priv->last_pts = pkt->dts;
}
dp->duration = pkt->duration * av_q2d(st->time_base);
if (pkt->convergence_duration > 0)
dp->duration = pkt->convergence_duration * av_q2d(st->time_base);
@ -729,6 +724,11 @@ static int demux_lavf_fill_buffer(demuxer_t *demux)
if (stream_control(demux->stream, STREAM_CTRL_GET_CURRENT_TIME, &pts) > 0)
dp->stream_pts = pts;
}
if (dp->pts != MP_NOPTS_VALUE) {
priv->last_pts = dp->pts * AV_TIME_BASE;
} else if (dp->dts != MP_NOPTS_VALUE) {
priv->last_pts = dp->dts * AV_TIME_BASE;
}
demuxer_add_packet(demux, stream, dp);
return 1;
}