mpegtsmux: Don't create streams with reserved PID

There are quite a few reserved PID in the various MPEG-TS (and derivate)
specifications which we should definitely not use. Those PID have a certain
meaning and purpose.

Furthermore, a lot of the code in the muxer implementation also makes assumption
on the purpose of streams based on their PID.

Therefore, when requesting a pad with a specific PID, make sure it is not a
restricted PID.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1561>
This commit is contained in:
Edward Hervey 2020-09-08 10:48:56 +02:00 committed by GStreamer Merge Bot
parent 5f0942fd36
commit 1068083135

View file

@ -1268,6 +1268,10 @@ gst_base_ts_mux_request_new_pad (GstElement * element, GstPadTemplate * templ,
if (name != NULL && sscanf (name, "sink_%d", &pid) == 1) {
if (tsmux_find_stream (mux->tsmux, pid))
goto stream_exists;
/* Make sure we don't use reserved PID.
* FIXME : This should be extended to other variants (ex: ATSC) reserved PID */
if (pid < TSMUX_START_ES_PID)
goto invalid_stream_pid;
} else {
pid = tsmux_get_new_pid (mux->tsmux);
}
@ -1288,6 +1292,13 @@ stream_exists:
(NULL));
return NULL;
}
invalid_stream_pid:
{
GST_ELEMENT_ERROR (element, STREAM, MUX,
("Invalid Elementary stream PID (< 0x40)"), (NULL));
return NULL;
}
}
static void