From 2526a5604e36300de4936d3d9de75e5170fd855f Mon Sep 17 00:00:00 2001 From: trilene Date: Wed, 16 Sep 2020 07:29:26 -0400 Subject: Remove bus watch when call ends --- src/WebRTCSession.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/WebRTCSession.cpp') diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp index e9822f7d..a3900b48 100644 --- a/src/WebRTCSession.cpp +++ b/src/WebRTCSession.cpp @@ -495,7 +495,7 @@ WebRTCSession::startPipeline(int opusPayloadType) } GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipe_)); - gst_bus_add_watch(bus, newBusMessage, this); + busWatchId_ = gst_bus_add_watch(bus, newBusMessage, this); gst_object_unref(bus); emit stateChanged(State::INITIATED); return true; @@ -601,6 +601,8 @@ WebRTCSession::end() gst_element_set_state(pipe_, GST_STATE_NULL); gst_object_unref(pipe_); pipe_ = nullptr; + g_source_remove(busWatchId_); + busWatchId_ = 0; } webrtc_ = nullptr; if (state_ != State::DISCONNECTED) -- cgit 1.5.1