mpegts: Take into account adaptation field discont
If the flag is set, there is an *expected* discontinuity: * For CC, we ignore the fact it's not contiguous * For PCR, we acknowledge the values aren't contiguous Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8420>
This commit is contained in:
parent
0a562a92d7
commit
63a03b167a
@ -414,8 +414,24 @@ mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 *
|
|||||||
if (packetizer->calculate_skew
|
if (packetizer->calculate_skew
|
||||||
&& GST_CLOCK_TIME_IS_VALID (packetizer->last_in_time)) {
|
&& GST_CLOCK_TIME_IS_VALID (packetizer->last_in_time)) {
|
||||||
pcrtable = get_pcr_table (packetizer, packet->pid);
|
pcrtable = get_pcr_table (packetizer, packet->pid);
|
||||||
|
/* There is a signalled discontinuity. Reset observations */
|
||||||
|
if (afcflags & MPEGTS_AFC_DISCONTINUITY_FLAG) {
|
||||||
|
GST_DEBUG ("pcr 0x%04x Discontinuity signalled, resetting observations",
|
||||||
|
packet->pid);
|
||||||
|
pcrtable->base_time = GST_CLOCK_TIME_NONE;
|
||||||
|
pcrtable->base_pcrtime = GST_CLOCK_TIME_NONE;
|
||||||
|
}
|
||||||
calculate_skew (packetizer, pcrtable, packet->pcr,
|
calculate_skew (packetizer, pcrtable, packet->pcr,
|
||||||
packetizer->last_in_time);
|
packetizer->last_in_time);
|
||||||
|
if (afcflags & MPEGTS_AFC_DISCONTINUITY_FLAG) {
|
||||||
|
MpegTSPCR *ignore_pcr =
|
||||||
|
packetizer->observations[packetizer->pcrtablelut[0x1fff]];
|
||||||
|
if (ignore_pcr) {
|
||||||
|
GST_DEBUG ("Resetting fallback PCR table due to discontinuity");
|
||||||
|
/* If there is a discontinuity, we need to reset the fallback PCR in case of */
|
||||||
|
ignore_pcr->base_time = GST_CLOCK_TIME_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (packetizer->calculate_offset) {
|
if (packetizer->calculate_offset) {
|
||||||
if (!pcrtable)
|
if (!pcrtable)
|
||||||
@ -990,6 +1006,12 @@ mpegts_packetizer_push_section (MpegTSPacketizer2 * packetizer,
|
|||||||
packetizer->streams[packet->pid] = stream;
|
packetizer->streams[packet->pid] = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (packet->afc_flags & MPEGTS_AFC_DISCONTINUITY_FLAG)) {
|
||||||
|
GST_DEBUG ("PID 0x%04x discontinuity flag, resetting stream counter",
|
||||||
|
packet->pid);
|
||||||
|
stream->continuity_counter = CONTINUITY_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
GST_MEMDUMP ("Full packet data", packet->data,
|
GST_MEMDUMP ("Full packet data", packet->data,
|
||||||
packet->data_end - packet->data);
|
packet->data_end - packet->data);
|
||||||
|
|
||||||
|
@ -2852,6 +2852,13 @@ gst_ts_demux_queue_data (GstTSDemux * demux, TSDemuxStream * stream,
|
|||||||
GST_LOG_OBJECT (demux, "pid: 0x%04x state:%d", stream->stream.pid,
|
GST_LOG_OBJECT (demux, "pid: 0x%04x state:%d", stream->stream.pid,
|
||||||
stream->state);
|
stream->state);
|
||||||
|
|
||||||
|
/* Handle expected discontinuity */
|
||||||
|
if (G_UNLIKELY (packet->afc_flags & MPEGTS_AFC_DISCONTINUITY_FLAG)) {
|
||||||
|
GST_LOG_OBJECT (demux, "pid: 0x%04x discontinuity flag, resetting counter",
|
||||||
|
stream->stream.pid);
|
||||||
|
stream->continuity_counter = CONTINUITY_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
size = packet->data_end - packet->payload;
|
size = packet->data_end - packet->payload;
|
||||||
data = packet->payload;
|
data = packet->payload;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user