From d0f1522f0de34847fa91d86fc1d7fc14fae9dff8 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 8 Oct 2021 23:39:29 +0200 Subject: [PATCH] GstEnginePipeline: Use gst_bus_remove_watch to remove bus watch --- src/engine/gstenginepipeline.cpp | 8 ++------ src/engine/gstenginepipeline.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index e3128a2a4..04ce94ef8 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -114,7 +114,6 @@ GstEnginePipeline::GstEnginePipeline(GstEngine *engine, QObject *parent) pad_added_cb_id_(-1), notify_source_cb_id_(-1), about_to_finish_cb_id_(-1), - bus_cb_id_(-1), unsupported_analyzer_(false) { if (!sElementDeleter) { @@ -142,12 +141,9 @@ GstEnginePipeline::~GstEnginePipeline() { g_signal_handler_disconnect(G_OBJECT(pipeline_), about_to_finish_cb_id_); } - if (bus_cb_id_ != -1) { - g_source_remove(bus_cb_id_); - } - GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline_)); if (bus) { + gst_bus_remove_watch(bus); gst_bus_set_sync_handler(bus, nullptr, nullptr, nullptr); gst_object_unref(bus); } @@ -468,7 +464,7 @@ bool GstEnginePipeline::InitAudioBin() { GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline_)); gst_bus_set_sync_handler(bus, BusCallbackSync, this, nullptr); - bus_cb_id_ = gst_bus_add_watch(bus, BusCallback, this); + gst_bus_add_watch(bus, BusCallback, this); gst_object_unref(bus); unsupported_analyzer_ = false; diff --git a/src/engine/gstenginepipeline.h b/src/engine/gstenginepipeline.h index 37b44a233..593b5c560 100644 --- a/src/engine/gstenginepipeline.h +++ b/src/engine/gstenginepipeline.h @@ -289,7 +289,6 @@ class GstEnginePipeline : public QObject { int pad_added_cb_id_; int notify_source_cb_id_; int about_to_finish_cb_id_; - int bus_cb_id_; QThreadPool set_state_threadpool_;