mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
more cleanup fixes
This commit is contained in:
parent
ac6d73f913
commit
273a5d35dc
9 changed files with 257 additions and 67 deletions
|
|
@ -395,7 +395,6 @@ on_state_notify (GObject *gobject,
|
|||
static gboolean
|
||||
gst_pulsevideo_sink_open (GstPulsevideoSink * pvsink)
|
||||
{
|
||||
|
||||
pvsink->ctx = pv_context_new (pvsink->context, "test-client", NULL);
|
||||
g_signal_connect (pvsink->ctx, "notify::state", (GCallback) on_state_notify, pvsink);
|
||||
|
||||
|
|
@ -425,6 +424,36 @@ connect_error:
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pulsevideo_sink_close (GstPulsevideoSink * pvsink)
|
||||
{
|
||||
if (pvsink->stream) {
|
||||
pv_stream_disconnect (pvsink->stream);
|
||||
}
|
||||
if (pvsink->ctx) {
|
||||
pv_context_disconnect(pvsink->ctx);
|
||||
|
||||
g_mutex_lock (&pvsink->lock);
|
||||
while (TRUE) {
|
||||
PvContextState state = pv_context_get_state (pvsink->ctx);
|
||||
|
||||
if (state == PV_CONTEXT_STATE_UNCONNECTED)
|
||||
break;
|
||||
|
||||
if (state == PV_CONTEXT_STATE_ERROR)
|
||||
break;
|
||||
|
||||
g_cond_wait (&pvsink->cond, &pvsink->lock);
|
||||
}
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
}
|
||||
|
||||
g_clear_object (&pvsink->stream);
|
||||
g_clear_object (&pvsink->ctx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_pulsevideo_sink_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
|
|
@ -460,6 +489,7 @@ gst_pulsevideo_sink_change_state (GstElement * element, GstStateChange transitio
|
|||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
gst_pulsevideo_sink_close (this);
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
g_main_loop_quit (this->loop);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue