summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.com>2013-02-06 11:09:52 -0300
committerThiago Santos <thiago.sousa.santos@collabora.com>2013-04-23 10:32:19 -0300
commit6382d4c0adacf2c154f024054944acd5977cafef (patch)
treee25b1df6646c1782a75a4904d26f722504a55cc4
parent054ffc6e2b0171937e6693f37f74e2d32d404017 (diff)
decodebin2: do not handle the next-groups list as if it was a single item
Decodebin2's chains store a next_groups list that was being handled as it could only have a single element. This is true for most of the chaining streams scenarios where streams change not very often. In more stressfull changing scenarios, like adaptive streams, those changes can happen very often, and in short time intervals. This could confuse decodebin2 as this list was always being used as a single element list. This patches makes it handle as a real list, using iteration instead of picking the first element as the correct one always.
-rw-r--r--gst/playback/gstdecodebin2.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c
index 39de78b2c..4577155b7 100644
--- a/gst/playback/gstdecodebin2.c
+++ b/gst/playback/gstdecodebin2.c
@@ -2573,7 +2573,12 @@ no_more_pads_cb (GstElement * element, GstDecodeChain * chain)
if (!chain->next_groups && chain->active_group) {
group = chain->active_group;
} else if (chain->next_groups) {
- group = chain->next_groups->data;
+ GList *iter;
+ for (iter = chain->next_groups; iter; iter = g_list_next (iter)) {
+ group = iter->data;
+ if (!group->no_more_pads)
+ break;
+ }
}
if (!group) {
GST_ERROR_OBJECT (chain->dbin, "can't find group for element");
@@ -2742,10 +2747,19 @@ gst_decode_chain_get_current_group (GstDecodeChain * chain)
} else if (!chain->active_group->overrun
&& !chain->active_group->no_more_pads) {
group = chain->active_group;
- } else if (chain->next_groups && (group = chain->next_groups->data)
- && !group->overrun && !group->no_more_pads) {
- /* group = chain->next_groups->data */
} else {
+ GList *iter;
+ group = NULL;
+ for (iter = chain->next_groups; iter; iter = g_list_next (iter)) {
+ GstDecodeGroup *next_group = iter->data;
+
+ if (!next_group->overrun && !next_group->no_more_pads) {
+ group = next_group;
+ break;
+ }
+ }
+ }
+ if (!group) {
group = gst_decode_group_new (chain->dbin, chain);
chain->next_groups = g_list_append (chain->next_groups, group);
}