mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
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:
parent
5f0942fd36
commit
1068083135
1 changed files with 11 additions and 0 deletions
|
@ -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 (name != NULL && sscanf (name, "sink_%d", &pid) == 1) {
|
||||||
if (tsmux_find_stream (mux->tsmux, pid))
|
if (tsmux_find_stream (mux->tsmux, pid))
|
||||||
goto stream_exists;
|
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 {
|
} else {
|
||||||
pid = tsmux_get_new_pid (mux->tsmux);
|
pid = tsmux_get_new_pid (mux->tsmux);
|
||||||
}
|
}
|
||||||
|
@ -1288,6 +1292,13 @@ stream_exists:
|
||||||
(NULL));
|
(NULL));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invalid_stream_pid:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (element, STREAM, MUX,
|
||||||
|
("Invalid Elementary stream PID (< 0x40)"), (NULL));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue