mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
tsdemux: Handle continuity mismatch in more cases
Packets of a given PID are meant to have sequential continuity counters (modulo 16). If there are not sequential, this is the sign of a broken stream, which we then consider as a discontinuity. But if that new packet is a frame start (PUSI is true), then we can resume from that packet without any damage.
This commit is contained in:
parent
56333073a9
commit
60cec38591
1 changed files with 15 additions and 4 deletions
|
@ -2430,12 +2430,23 @@ gst_ts_demux_queue_data (GstTSDemux * demux, TSDemuxStream * stream,
|
||||||
} else if ((cc == stream->continuity_counter + 1 ||
|
} else if ((cc == stream->continuity_counter + 1 ||
|
||||||
(stream->continuity_counter == MAX_CONTINUITY && cc == 0))) {
|
(stream->continuity_counter == MAX_CONTINUITY && cc == 0))) {
|
||||||
GST_LOG ("CONTINUITY: Got expected %d", cc);
|
GST_LOG ("CONTINUITY: Got expected %d", cc);
|
||||||
|
} else {
|
||||||
|
if (stream->state != PENDING_PACKET_EMPTY) {
|
||||||
|
if (packet->payload_unit_start_indicator) {
|
||||||
|
/* A mismatch is fatal, except if this is the beginning of a new
|
||||||
|
* frame (from which we can recover) */
|
||||||
|
if (G_UNLIKELY (stream->data)) {
|
||||||
|
g_free (stream->data);
|
||||||
|
stream->data = NULL;
|
||||||
|
}
|
||||||
|
stream->state = PENDING_PACKET_HEADER;
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("CONTINUITY: Mismatch packet %d, stream %d",
|
GST_WARNING ("CONTINUITY: Mismatch packet %d, stream %d",
|
||||||
cc, stream->continuity_counter);
|
cc, stream->continuity_counter);
|
||||||
if (stream->state != PENDING_PACKET_EMPTY)
|
|
||||||
stream->state = PENDING_PACKET_DISCONT;
|
stream->state = PENDING_PACKET_DISCONT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stream->continuity_counter = cc;
|
stream->continuity_counter = cc;
|
||||||
|
|
||||||
if (stream->state == PENDING_PACKET_EMPTY) {
|
if (stream->state == PENDING_PACKET_EMPTY) {
|
||||||
|
|
Loading…
Reference in a new issue