summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2018-02-10 15:41:10 +0100
committerEdward Hervey <bilboed@bilboed.com>2018-02-10 15:43:54 +0100
commiteacb7a77d2f00304a4af884d2cfc4966da861acf (patch)
tree7d9f89af28d0c189cbe9e3b414e19b8cf2acdf5b
parentec7d81f67c844f692113d756db2bd328f92bd554 (diff)
playbin3: Re-enable buffering message handling
Buffering messages are only sent for the active group (in case there is more than one). If the inactive group posts buffering messages we keep the last one around and will post it once it becomes the playing one.
-rw-r--r--gst/playback/gstplaybin3.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gst/playback/gstplaybin3.c b/gst/playback/gstplaybin3.c
index 5eb56ce89..6e4bf72d6 100644
--- a/gst/playback/gstplaybin3.c
+++ b/gst/playback/gstplaybin3.c
@@ -2431,6 +2431,7 @@ gst_play_bin3_handle_message (GstBin * bin, GstMessage * msg)
GstSourceGroup *group = NULL, *other_group = NULL;
gboolean changed = FALSE;
guint group_id;
+ GstMessage *buffering_msg;
if (!gst_message_parse_group_id (msg, &group_id)) {
GST_ERROR_OBJECT (bin,
@@ -2465,30 +2466,30 @@ gst_play_bin3_handle_message (GstBin * bin, GstMessage * msg)
if (group->playing == FALSE)
changed = TRUE;
group->playing = TRUE;
+ buffering_msg = group->pending_buffering_msg;
+ group->pending_buffering_msg = NULL;
GST_SOURCE_GROUP_UNLOCK (group);
+
GST_SOURCE_GROUP_LOCK (other_group);
other_group->playing = FALSE;
GST_SOURCE_GROUP_UNLOCK (other_group);
+
debug_groups (playbin);
GST_PLAY_BIN3_UNLOCK (playbin);
if (changed)
gst_play_bin3_check_group_status (playbin);
else
GST_DEBUG_OBJECT (bin, "Groups didn't changed");
- }
-#if 0
- else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_BUFFERING) {
- GstSourceGroup *group = playbin->curr_group;
- gboolean pending;
-
- /* drop buffering messages from child queues while we are switching
- * groups (because the application set a new uri in about-to-finish)
- * if the playsink queue still has buffers to play */
+ /* If there was a pending buffering message to send, do it now */
+ if (buffering_msg)
+ GST_BIN_CLASS (parent_class)->handle_message (bin, buffering_msg);
+ } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_BUFFERING) {
+ GstSourceGroup *group;
+ /* Only post buffering messages for group which is currently playing */
+ group = find_source_group_owner (playbin, msg->src);
GST_SOURCE_GROUP_LOCK (group);
- pending = group->stream_changed_pending;
-
- if (pending) {
+ if (!group->playing) {
GST_DEBUG_OBJECT (playbin, "Storing buffering message from pending group "
"%p %" GST_PTR_FORMAT, group, msg);
gst_message_replace (&group->pending_buffering_msg, msg);
@@ -2496,9 +2497,7 @@ gst_play_bin3_handle_message (GstBin * bin, GstMessage * msg)
msg = NULL;
}
GST_SOURCE_GROUP_UNLOCK (group);
- }
-#endif
- if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAM_COLLECTION) {
+ } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STREAM_COLLECTION) {
GstStreamCollection *collection = NULL;
gst_message_parse_stream_collection (msg, &collection);