summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortrilene <trilene@runbox.com>2020-09-16 07:29:26 -0400
committertrilene <trilene@runbox.com>2020-09-16 07:29:26 -0400
commit2526a5604e36300de4936d3d9de75e5170fd855f (patch)
treed4f953e885097584d5dca42f04f2fb76f3d016cd /src
parentDon't show default audio source in settings (diff)
downloadnheko-2526a5604e36300de4936d3d9de75e5170fd855f.tar.xz
Remove bus watch when call ends
Diffstat (limited to 'src')
-rw-r--r--src/WebRTCSession.cpp4
-rw-r--r--src/WebRTCSession.h9
2 files changed, 8 insertions, 5 deletions
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) diff --git a/src/WebRTCSession.h b/src/WebRTCSession.h
index 56d76fa8..8e78812f 100644 --- a/src/WebRTCSession.h +++ b/src/WebRTCSession.h
@@ -64,10 +64,11 @@ private slots: private: WebRTCSession(); - bool initialised_ = false; - State state_ = State::DISCONNECTED; - GstElement *pipe_ = nullptr; - GstElement *webrtc_ = nullptr; + bool initialised_ = false; + State state_ = State::DISCONNECTED; + GstElement *pipe_ = nullptr; + GstElement *webrtc_ = nullptr; + unsigned int busWatchId_ = 0; std::string stunServer_; std::vector<std::string> turnServers_; GList *audioSources_ = nullptr;