BugFix Ensure complete close of session upon termination

Async ending of gst pipeline in stream and media player sources caused a crash at termination as source was still not closed when process was ended. Fix is to ask for an immediate termination of gst pipeline upon delete of stream, and to wait for mixer manager to end current session when clearing.
This commit is contained in:
Bruno Herbelin
2024-02-28 00:39:03 +01:00
parent 1ba8ff06e1
commit 05f593e40c
8 changed files with 33 additions and 27 deletions

View File

@@ -73,7 +73,7 @@ Stream::Stream()
Stream::~Stream()
{
Stream::close();
Stream::close(false);
// cleanup opengl texture
if (textureindex_)
@@ -368,7 +368,7 @@ void async_terminate( GstElement *p )
gst_object_unref ( p );
}
void Stream::close()
void Stream::close(bool async)
{
// not opened?
if (!opened_) {
@@ -386,7 +386,10 @@ void Stream::close()
if (pipeline_ != nullptr) {
// end pipeline asynchronously
std::thread(async_terminate, pipeline_).detach();
if (async)
std::thread(async_terminate, pipeline_).detach();
else
async_terminate(pipeline_);
pipeline_ = nullptr;
}