62 lines
2.1 KiB
Diff
62 lines
2.1 KiB
Diff
From 77af65033203b49b23640f856df964e7a6b5868b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= <scerveau@collabora.com>
|
|
Date: Mon, 9 Aug 2021 15:38:08 +0200
|
|
Subject: [PATCH 02/11] playbin2: send one about-to-finish per group
|
|
|
|
To avoid multiple about-to-finish signal,
|
|
driving the app to drop uris, a group should
|
|
signal "about-to-finish" and setup a next uri
|
|
only one time.
|
|
|
|
Fixes #930
|
|
---
|
|
gst/playback/gstplaybin2.c | 11 +++++++++++
|
|
1 file changed, 11 insertions(+)
|
|
|
|
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
|
|
index bcbfc20..3a441af 100644
|
|
--- a/gst/playback/gstplaybin2.c
|
|
+++ b/gst/playback/gstplaybin2.c
|
|
@@ -319,6 +319,9 @@ struct _GstSourceGroup
|
|
GstElement *video_sink;
|
|
GstElement *text_sink;
|
|
|
|
+ /* Avoid multiple about to finish handling */
|
|
+ gboolean pending_about_to_finish;
|
|
+
|
|
/* uridecodebins for uri and subtitle uri */
|
|
GstElement *uridecodebin;
|
|
GstElement *suburidecodebin;
|
|
@@ -3933,6 +3936,12 @@ drained_cb (GstElement * decodebin, GstSourceGroup * group)
|
|
|
|
GST_DEBUG_OBJECT (playbin, "about to finish in group %p", group);
|
|
|
|
+ if (group->pending_about_to_finish) {
|
|
+ GST_DEBUG_OBJECT (playbin,
|
|
+ "Pending about to finish for group uri %s, do not handle.", group->uri);
|
|
+ return;
|
|
+ }
|
|
+
|
|
/* after this call, we should have a next group to activate or we EOS */
|
|
g_signal_emit (G_OBJECT (playbin),
|
|
gst_play_bin_signals[SIGNAL_ABOUT_TO_FINISH], 0, NULL);
|
|
@@ -3940,6 +3949,7 @@ drained_cb (GstElement * decodebin, GstSourceGroup * group)
|
|
/* now activate the next group. If the app did not set a uri, this will
|
|
* fail and we can do EOS */
|
|
setup_next_source (playbin, GST_STATE_PAUSED);
|
|
+ group->pending_about_to_finish = TRUE;
|
|
}
|
|
|
|
/* Like gst_element_factory_can_sink_any_caps() but doesn't
|
|
@@ -5515,6 +5525,7 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
|
|
/* allow state changes of the playbin affect the group elements now */
|
|
group_set_locked_state_unlocked (playbin, group, FALSE);
|
|
group->active = TRUE;
|
|
+ group->pending_about_to_finish = FALSE;
|
|
GST_SOURCE_GROUP_UNLOCK (group);
|
|
|
|
return state_ret;
|
|
--
|
|
2.20.1
|
|
|