Merge pull request #283 from trilene/voip

Remove bus watch when call ends
This commit is contained in:
DeepBlueV7.X 2020-09-16 21:06:57 +02:00 committed by GitHub
commit 66d6307252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -495,7 +495,7 @@ WebRTCSession::startPipeline(int opusPayloadType)
} }
GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipe_)); 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); gst_object_unref(bus);
emit stateChanged(State::INITIATED); emit stateChanged(State::INITIATED);
return true; return true;
@ -601,6 +601,8 @@ WebRTCSession::end()
gst_element_set_state(pipe_, GST_STATE_NULL); gst_element_set_state(pipe_, GST_STATE_NULL);
gst_object_unref(pipe_); gst_object_unref(pipe_);
pipe_ = nullptr; pipe_ = nullptr;
g_source_remove(busWatchId_);
busWatchId_ = 0;
} }
webrtc_ = nullptr; webrtc_ = nullptr;
if (state_ != State::DISCONNECTED) if (state_ != State::DISCONNECTED)

View File

@ -64,10 +64,11 @@ private slots:
private: private:
WebRTCSession(); WebRTCSession();
bool initialised_ = false; bool initialised_ = false;
State state_ = State::DISCONNECTED; State state_ = State::DISCONNECTED;
GstElement *pipe_ = nullptr; GstElement *pipe_ = nullptr;
GstElement *webrtc_ = nullptr; GstElement *webrtc_ = nullptr;
unsigned int busWatchId_ = 0;
std::string stunServer_; std::string stunServer_;
std::vector<std::string> turnServers_; std::vector<std::string> turnServers_;
GList *audioSources_ = nullptr; GList *audioSources_ = nullptr;