Commit 765c56bf authored by Marton Balint's avatar Marton Balint

avformat/mpegts: fix teletext PTS when selecting teletext streams only

After a1b4f120 the teletext PTS values were set
to AV_NOPTS_VALUE if the stream of the PCR pid was discarded.

What actually matters is that if we parse the PCR of the PCR PID or not, so
let's use the cached discard value of the actual PCR PID instead of the stream
discard value, which may be different.

Also fixes ticket #7567, which was caused by the fact that teletext PTS values
were not touched if the PCR pid was discarded even before
a1b4f120.
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent a370582b
...@@ -1303,15 +1303,17 @@ skip: ...@@ -1303,15 +1303,17 @@ skip:
st = pst; st = pst;
} }
} }
if (f->last_pcr != -1 && st && st->discard != AVDISCARD_ALL) { if (f->last_pcr != -1 && !f->discard) {
// teletext packets do not always have correct timestamps, // teletext packets do not always have correct timestamps,
// the standard says they should be handled after 40.6 ms at most, // the standard says they should be handled after 40.6 ms at most,
// and the pcr error to this packet should be no more than 100 ms. // and the pcr error to this packet should be no more than 100 ms.
// TODO: we should interpolate the PCR, not just use the last one // TODO: we should interpolate the PCR, not just use the last one
int64_t pcr = f->last_pcr / 300; int64_t pcr = f->last_pcr / 300;
pcr_found = 1; pcr_found = 1;
pes->st->pts_wrap_reference = st->pts_wrap_reference; if (st) {
pes->st->pts_wrap_behavior = st->pts_wrap_behavior; pes->st->pts_wrap_reference = st->pts_wrap_reference;
pes->st->pts_wrap_behavior = st->pts_wrap_behavior;
}
if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) { if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) {
pes->pts = pes->dts = pcr; pes->pts = pes->dts = pcr;
} else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT && } else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT &&
......
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