From 50228dddf8c1231a35a1ea5eb5ebde3a11d49d9e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 6 Apr 2016 21:05:44 +0200 Subject: [PATCH] pinossink: stop and disconnect the old stream when renegotiating When we get a new format, stop, disconnect and unref the old stream. In the future we should try to send a format change on the existing stream. --- pinos/gst/gstpinossink.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pinos/gst/gstpinossink.c b/pinos/gst/gstpinossink.c index 8adf3051b..1d58bfda7 100644 --- a/pinos/gst/gstpinossink.c +++ b/pinos/gst/gstpinossink.c @@ -366,6 +366,11 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) } pinos_main_loop_lock (pinossink->loop); + if (pinossink->stream) { + pinos_stream_stop (pinossink->stream); + pinos_stream_disconnect (pinossink->stream); + g_clear_object (&pinossink->stream); + } pinossink->stream = pinos_stream_new (pinossink->ctx, pinossink->client_name, props); g_signal_connect (pinossink->stream, "notify::state", (GCallback) on_stream_notify, pinossink); g_signal_connect (pinossink->stream, "new-buffer", (GCallback) on_new_buffer, pinossink);