From f59c6c356e4a9d82907c2c9319ab82cf743792e1 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 9 Nov 2024 19:22:56 +0100 Subject: [PATCH] GstEnginePipeline: Get audio-sink --- src/engine/gstenginepipeline.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index a51d87821..2cfd5ae9f 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -182,9 +182,14 @@ GstEnginePipeline::~GstEnginePipeline() { if (state() != GST_STATE_NULL) { gst_element_set_state(pipeline_, GST_STATE_NULL); } + + GstElement *audiobin = nullptr; + g_object_get(GST_OBJECT(pipeline_), "audio-sink", &audiobin, nullptr); + gst_object_unref(GST_OBJECT(pipeline_)); pipeline_ = nullptr; - if (audiobin_ && !pipeline_connected_.value()) { + + if (audiobin_ && audiobin_ != audiobin) { gst_object_unref(GST_OBJECT(audiobin_)); } audiobin_ = nullptr;