gstengine: Clean up buffer references in error cases

This commit is contained in:
Jim Broadus 2020-05-23 00:17:57 -07:00 committed by John Maguire
parent 407a99b2fa
commit 7378e5b141
1 changed files with 2 additions and 0 deletions

View File

@ -275,6 +275,7 @@ void GstEngine::ConsumeBuffer(GstBuffer* buffer, int pipeline_id) {
Q_ARG(GstBuffer*, buffer), Q_ARG(GstBuffer*, buffer),
Q_ARG(int, pipeline_id))) { Q_ARG(int, pipeline_id))) {
qLog(Warning) << "Failed to invoke AddBufferToScope on GstEngine"; qLog(Warning) << "Failed to invoke AddBufferToScope on GstEngine";
gst_buffer_unref(buffer);
} }
} }
@ -339,6 +340,7 @@ void GstEngine::UpdateScope(int chunk_length) {
// in case a buffer doesn't arrive in time // in case a buffer doesn't arrive in time
if (scope_chunk_ >= scope_chunks_) { if (scope_chunk_ >= scope_chunks_) {
scope_chunk_ = 0; scope_chunk_ = 0;
gst_buffer_unmap(latest_buffer_, &map);
return; return;
} }