static void parsebin_pad_removed_cb (GstElement * demux, GstPad * pad,
DecodebinInput * input);
+/* WITH SELECTION_LOCK TAKEN! */
static gboolean
pending_pads_are_eos (DecodebinInput * input)
{
return TRUE;
}
+/* WITH SELECTION_LOCK TAKEN! */
static gboolean
all_inputs_are_eos (GstDecodebin3 * dbin)
{
return TRUE;
}
+/* WITH SELECTION_LOCK TAKEN! */
static void
check_all_streams_for_eos (GstDecodebin3 * dbin)
{
input->saw_eos = TRUE;
if (all_inputs_are_eos (input->dbin)) {
GST_DEBUG_OBJECT (pad, "real input pad, marking as EOS");
+ SELECTION_LOCK (input->dbin);
check_all_streams_for_eos (input->dbin);
+ SELECTION_UNLOCK (input->dbin);
} else {
GstPad *peer = gst_pad_get_peer (input->srcpad);
if (peer) {
(GstPadProbeCallback) parse_chain_output_probe, res, NULL);
/* Add to list of current input streams */
+ SELECTION_LOCK (dbin);
dbin->input_streams = g_list_append (dbin->input_streams, res);
+ SELECTION_UNLOCK (dbin);
GST_DEBUG_OBJECT (pad, "Done creating input stream");
return res;
}
+/* WITH SELECTION_LOCK TAKEN! */
static void
remove_input_stream (GstDecodebin3 * dbin, DecodebinInputStream * stream)
{
}
}
- g_mutex_lock (&dbin->selection_lock);
slot = get_slot_for_input (dbin, stream);
- g_mutex_unlock (&dbin->selection_lock);
if (slot) {
slot->pending_stream = NULL;
slot->input = NULL;
GstDecodebin3 *dbin = input->dbin;
GList *tmp, *unused_slot = NULL;
- GST_FIXME_OBJECT (dbin, "Need a lock !");
-
GST_DEBUG_OBJECT (pad, "Got a buffer ! UNBLOCK !");
/* Any data out the demuxer means it's not creating pads
/* 2. Remove unused streams (push EOS) */
GST_DEBUG_OBJECT (dbin, "Removing unused streams");
+ SELECTION_LOCK (dbin);
tmp = dbin->input_streams;
while (tmp != NULL) {
DecodebinInputStream *input_stream = (DecodebinInputStream *) tmp->data;
} else
tmp = next;
}
+ SELECTION_UNLOCK (dbin);
GST_DEBUG_OBJECT (dbin, "Creating new streams (if needed)");
/* 3. Create new streams */
SELECTION_LOCK (dbin);
slot = get_slot_for_input (dbin, input);
- SELECTION_UNLOCK (dbin);
remove_input_stream (dbin, input);
-
- SELECTION_LOCK (dbin);
if (slot && g_list_find (dbin->slots, slot) && slot->is_drained) {
/* if slot is still there and already drained, remove it in here */
if (slot->output) {
GstElement *multiqueue;
- /* FIXME : Mutex for protecting values below */
- GstStreamCollection *collection; /* Active collection */
-
+ /* selection_lock protects access to following variables */
+ GMutex selection_lock;
GList *input_streams; /* List of DecodebinInputStream for active collection */
GList *output_streams; /* List of DecodebinOutputStream used for output */
GList *slots; /* List of MultiQueueSlot */
guint slot_id;
- /* selection_lock protects access to following variables */
- GMutex selection_lock;
+ /* Active collection */
+ GstStreamCollection *collection;
/* requested selection of stream-id to activate post-multiqueue */
GList *requested_selection;
/* list of stream-id currently activated in output */
* FIXME : Is this really needed ? */
GList *pending_collection;
-
/* Factories */
GMutex factories_lock;
guint32 factories_cookie;
#endif
/* Store collection for later usage */
+ SELECTION_LOCK (dbin);
if (dbin->collection == NULL) {
dbin->collection = collection;
} else {
/* dbin->pending_collection = */
/* g_list_append (dbin->pending_collection, collection); */
}
+ SELECTION_UNLOCK (dbin);
}
static void
posting_collection = TRUE;
INPUT_UNLOCK (dbin);
}
+
SELECTION_LOCK (dbin);
if (dbin->collection && collection != dbin->collection) {
/* Replace collection message, we most likely aggregated it */
message = new_msg;
}
SELECTION_UNLOCK (dbin);
+
if (collection)
gst_object_unref (collection);
break;
}
slot->probe_id = 0;
dbin->slots = g_list_remove (dbin->slots, slot);
- free_multiqueue_slot_async (dbin, slot);
SELECTION_UNLOCK (dbin);
+
+ free_multiqueue_slot_async (dbin, slot);
ret = GST_PAD_PROBE_REMOVE;
}
break;
gst_stream_type_get_name (type));
slot = g_new0 (MultiQueueSlot, 1);
slot->dbin = dbin;
+
slot->id = dbin->slot_id++;
+
slot->type = type;
slot->sink_pad = gst_element_get_request_pad (dbin->multiqueue, "sink_%u");
if (slot->sink_pad == NULL)
goto fail;
+
it = gst_pad_iterate_internal_links (slot->sink_pad);
if (!it || (gst_iterator_next (it, &item)) != GST_ITERATOR_OK
|| ((slot->src_pad = g_value_dup_object (&item)) == NULL)) {
GST_DEBUG ("Created new slot %u (%p) (%s:%s)", slot->id, slot,
GST_DEBUG_PAD_NAME (slot->src_pad));
+
dbin->slots = g_list_append (dbin->slots, slot);
+
return slot;
/* ERRORS */