Commit 5c000cb0 authored by Vivia Nikolaidou's avatar Vivia Nikolaidou 🦆 Committed by GStreamer Marge Bot
Browse files

mpegtspacketizer: memcmp potentially seen_before data

Theoretically the version number is incremented every time there's a new
section, but in a world of streaming we can't easily make that
assumption.

An example of a broken use case is when we're cat-ing two mpeg-ts files
together, which is equivalent of capturing a DVB stream while switching
channels. A set-top box would know that we switched the channels and
reset the demuxer, but in practice this might not happen.

Part-of: <gstreamer/gst-plugins-bad!2555>
parent 54029f8f
Pipeline #435454 waiting for manual action with stages
in 1 minute and 52 seconds
......@@ -154,7 +154,7 @@ find_subtable (GSList * subtables, guint8 table_id, guint16 subtable_extension)
static gboolean
seen_section_before (MpegTSPacketizerStream * stream, guint8 table_id,
guint16 subtable_extension, guint8 version_number, guint8 section_number,
guint8 last_section_number)
guint8 last_section_number, guint8 * data_start, gsize to_read)
{
MpegTSPacketizerStreamSubtable *subtable;
......@@ -175,7 +175,17 @@ seen_section_before (MpegTSPacketizerStream * stream, guint8 table_id,
return FALSE;
}
/* Finally return whether we saw that section or not */
return MPEGTS_BIT_IS_SET (subtable->seen_section, section_number);
if (!MPEGTS_BIT_IS_SET (subtable->seen_section, section_number)) {
GST_DEBUG ("Different section_number");
return FALSE;
}
if (stream->section_data) {
/* Everything else is the same, fall back to memcmp */
return (memcmp (stream->section_data, data_start, to_read) != 0);
}
return FALSE;
}
static MpegTSPacketizerStreamSubtable *
......@@ -1189,7 +1199,8 @@ section_start:
* * same section_number was seen
*/
if (seen_section_before (stream, table_id, subtable_extension,
version_number, section_number, last_section_number)) {
version_number, section_number, last_section_number, data_start,
to_read)) {
GST_DEBUG
("PID 0x%04x Already processed table_id:0x%02x subtable_extension:0x%04x, version_number:%d, section_number:%d",
packet->pid, table_id, subtable_extension, version_number,
......
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