[rhythmbox] xfade: hold stream lock for more of link_and_unblock_stream()
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] xfade: hold stream lock for more of link_and_unblock_stream()
- Date: Sun, 27 Dec 2020 03:54:42 +0000 (UTC)
commit 9c9d0b53afc65bd2ecb171dfdf92794bac50ffac
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Dec 5 20:42:40 2020 +1000
xfade: hold stream lock for more of link_and_unblock_stream()
In some situations this can be called concurrently on two threads,
so it needs more protection.
backends/gstreamer/rb-player-gst-xfade.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index 420cf7f65..98b4b1781 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -1087,8 +1087,10 @@ link_and_unblock_stream (RBXFadeStream *stream, GError **error)
return FALSE;
}
+ g_mutex_lock (&stream->lock);
if (stream->adder_pad != NULL) {
rb_debug ("stream %s is already linked", stream->uri);
+ g_mutex_unlock (&stream->lock);
return TRUE;
}
stream->needs_unlink = FALSE;
@@ -1105,6 +1107,7 @@ link_and_unblock_stream (RBXFadeStream *stream, GError **error)
RB_PLAYER_ERROR,
RB_PLAYER_ERROR_GENERAL,
_("Failed to link new stream into GStreamer pipeline"));
+ g_mutex_unlock (&stream->lock);
return FALSE;
}
@@ -1120,14 +1123,13 @@ link_and_unblock_stream (RBXFadeStream *stream, GError **error)
RB_PLAYER_ERROR_GENERAL,
_("Failed to link new stream into GStreamer pipeline"));
return FALSE;
+ g_mutex_unlock (&stream->lock);
}
-
g_atomic_int_inc (&player->priv->linked_streams);
rb_debug ("now have %d linked streams", player->priv->linked_streams);
result = TRUE;
- g_mutex_lock (&stream->lock);
if (stream->src_blocked) {
GstStateChangeReturn state_ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]