summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-06-05 14:18:34 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-06-06 10:31:59 +0200
commit38bb55c472233174f6c1beb5e4977f06f78d0a17 (patch)
tree8ffe4ca2f709f26f8100e31c4528324a5655c9d2 /gst
parentfa4f487d8fd61b6e73e0433b20b4438a124accad (diff)
mpegtsmux: avoid PID collision for auto-generated PID
Diffstat (limited to 'gst')
-rw-r--r--gst/mpegtsmux/tsmux/tsmux.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gst/mpegtsmux/tsmux/tsmux.c b/gst/mpegtsmux/tsmux/tsmux.c
index 4e5a196d1..838c48a0c 100644
--- a/gst/mpegtsmux/tsmux/tsmux.c
+++ b/gst/mpegtsmux/tsmux/tsmux.c
@@ -356,9 +356,13 @@ tsmux_get_new_pid (TsMux * mux)
{
g_return_val_if_fail (mux != NULL, -1);
- /* FIXME: It's possible that this next PID is already taken if a
- * specific PID was requested earlier. We should find a free PID */
- return mux->next_stream_pid++;
+ /* make sure this PID is free
+ * (and not taken by a specific earlier request) */
+ do {
+ mux->next_stream_pid++;
+ } while (tsmux_find_stream (mux, mux->next_stream_pid));
+
+ return mux->next_stream_pid;
}
/**