Commit 8916f1fb authored by Justin Ruggles's avatar Justin Ruggles

avformat: only fill-in interpolated timestamps if duration is non-zero

This avoids returning duplicate timestamps for multiple packets when the
demuxer does not provide all timestamps and packet duration is not known.
parent ff499157
...@@ -985,6 +985,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, ...@@ -985,6 +985,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
} }
} }
if (pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE ||
duration) {
/* presentation is not delayed : PTS and DTS are the same */ /* presentation is not delayed : PTS and DTS are the same */
if(pkt->pts == AV_NOPTS_VALUE) if(pkt->pts == AV_NOPTS_VALUE)
pkt->pts = pkt->dts; pkt->pts = pkt->dts;
...@@ -996,6 +998,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, ...@@ -996,6 +998,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
st->cur_dts = pkt->pts + duration; st->cur_dts = pkt->pts + duration;
} }
} }
}
if(pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){ if(pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){
st->pts_buffer[0]= pkt->pts; st->pts_buffer[0]= pkt->pts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment