mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
decodebin3: Fix global group-id handling
The goal of the "global" group-id is to fix new inputs that do not come from the same "source" as others. In order to ensure all "current" streams have the same group-id we distribute the first valid group-id to all streams. This commit fixes two issues with that: * When inputs are unlinked they weren't always properly resetted (it would only work if parsebin is used, which is no longer the default in uridecodebin3/playbin3). * When computing the global group-id, take into account unset group-id (i.e. GST_GROUP_ID_INVALID). Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1698 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3712>
This commit is contained in:
parent
4f0abc32e7
commit
1fe99ebae1
1 changed files with 21 additions and 10 deletions
|
@ -816,6 +816,9 @@ set_input_group_id (DecodebinInput * input, guint32 * group_id)
|
||||||
GST_DEBUG_OBJECT (dbin,
|
GST_DEBUG_OBJECT (dbin,
|
||||||
"Setting current group id to %" G_GUINT32_FORMAT, *group_id);
|
"Setting current group id to %" G_GUINT32_FORMAT, *group_id);
|
||||||
dbin->current_group_id = *group_id;
|
dbin->current_group_id = *group_id;
|
||||||
|
} else {
|
||||||
|
GST_DEBUG_OBJECT (dbin, "Returning global group id %" G_GUINT32_FORMAT,
|
||||||
|
dbin->current_group_id);
|
||||||
}
|
}
|
||||||
*group_id = dbin->current_group_id;
|
*group_id = dbin->current_group_id;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -979,18 +982,30 @@ recalculate_group_id (GstDecodebin3 * dbin)
|
||||||
guint32 common_group_id;
|
guint32 common_group_id;
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (dbin,
|
||||||
|
"recalculating, current global group_id: %" G_GUINT32_FORMAT,
|
||||||
|
dbin->current_group_id);
|
||||||
|
|
||||||
common_group_id = dbin->main_input->group_id;
|
common_group_id = dbin->main_input->group_id;
|
||||||
|
|
||||||
for (iter = dbin->other_inputs; iter; iter = iter->next) {
|
for (iter = dbin->other_inputs; iter; iter = iter->next) {
|
||||||
DecodebinInput *input = iter->data;
|
DecodebinInput *input = iter->data;
|
||||||
|
|
||||||
if (input->group_id != common_group_id)
|
if (input->group_id != common_group_id) {
|
||||||
|
if (common_group_id != GST_GROUP_ID_INVALID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
common_group_id = input->group_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (common_group_id == dbin->current_group_id) {
|
||||||
|
GST_DEBUG_OBJECT (dbin, "Global group_id hasn't changed");
|
||||||
|
} else {
|
||||||
GST_DEBUG_OBJECT (dbin, "Updating global group_id to %" G_GUINT32_FORMAT,
|
GST_DEBUG_OBJECT (dbin, "Updating global group_id to %" G_GUINT32_FORMAT,
|
||||||
common_group_id);
|
common_group_id);
|
||||||
dbin->current_group_id = common_group_id;
|
dbin->current_group_id = common_group_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CALL with INPUT LOCK */
|
/* CALL with INPUT LOCK */
|
||||||
|
@ -1032,12 +1047,8 @@ gst_decodebin3_input_pad_unlink (GstPad * pad, GstPad * peer,
|
||||||
GST_LOG_OBJECT (dbin, "Got unlink on input pad %" GST_PTR_FORMAT, pad);
|
GST_LOG_OBJECT (dbin, "Got unlink on input pad %" GST_PTR_FORMAT, pad);
|
||||||
|
|
||||||
INPUT_LOCK (dbin);
|
INPUT_LOCK (dbin);
|
||||||
if (input->parsebin == NULL) {
|
|
||||||
INPUT_UNLOCK (dbin);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GST_PAD_MODE (pad) == GST_PAD_MODE_PULL) {
|
if (input->parsebin && GST_PAD_MODE (pad) == GST_PAD_MODE_PULL) {
|
||||||
GST_DEBUG_OBJECT (dbin, "Resetting parsebin since it's pull-based");
|
GST_DEBUG_OBJECT (dbin, "Resetting parsebin since it's pull-based");
|
||||||
reset_input_parsebin (dbin, input);
|
reset_input_parsebin (dbin, input);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue