From 9f96c5e573d78d5f87c19e05eb67478d2308d41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 7 Apr 2020 13:47:04 +0300 Subject: [PATCH] gstreamer/buffer: Unmap memory in flush() of the Write impl of the buffer cursor This makes sure that any remaining data is actually written out as part of the unmapping, which might be necessary depending on the memory type. --- gstreamer/src/buffer_cursor.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gstreamer/src/buffer_cursor.rs b/gstreamer/src/buffer_cursor.rs index 88ae37459..d393b0d53 100644 --- a/gstreamer/src/buffer_cursor.rs +++ b/gstreamer/src/buffer_cursor.rs @@ -218,6 +218,13 @@ macro_rules! define_write_impl( } fn flush(&mut self) -> Result<(), io::Error> { + if !self.map_info.memory.is_null() { + unsafe { + gst_sys::gst_memory_unmap(self.map_info.memory, &mut self.map_info); + self.map_info.memory = ptr::null_mut(); + } + } + Ok(()) } }