summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 576f4aa708..7ed30ee715 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1049,12 +1049,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
if (pkt->dts != AV_NOPTS_VALUE) {
// got DTS from the stream, update reference timestamp
st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den;
- pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
} else if (st->reference_dts != AV_NOPTS_VALUE) {
// compute DTS based on reference timestamp
pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den;
- pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
}
+
+ if (st->reference_dts != AV_NOPTS_VALUE && pkt->pts == AV_NOPTS_VALUE)
+ pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
+
if (pc->dts_sync_point > 0)
st->reference_dts = pkt->dts; // new reference
}