From 1f45c78ebbbfcbb26bbc1f09682f03d2adf936bb Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 24 May 2020 23:21:26 +0200 Subject: [PATCH] Unmap buffer references in error cases --- src/engine/gstengine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/gstengine.cpp b/src/engine/gstengine.cpp index 74e68e97f..0944701d0 100644 --- a/src/engine/gstengine.cpp +++ b/src/engine/gstengine.cpp @@ -419,6 +419,7 @@ void GstEngine::ConsumeBuffer(GstBuffer *buffer, const int pipeline_id, const QS // Schedule this to run in the GUI thread. The buffer gets added to the queue and unreffed by UpdateScope. if (!QMetaObject::invokeMethod(this, "AddBufferToScope", Q_ARG(GstBuffer*, buffer), Q_ARG(int, pipeline_id), Q_ARG(QString, format))) { qLog(Warning) << "Failed to invoke AddBufferToScope on GstEngine"; + gst_buffer_unref(buffer); } } @@ -802,6 +803,7 @@ void GstEngine::UpdateScope(const int chunk_length) { // In case a buffer doesn't arrive in time if (scope_chunk_ >= scope_chunks_) { scope_chunk_ = 0; + gst_buffer_unmap(latest_buffer_, &map); return; }