]> git.sesse.net Git - nageru/blobdiff - pbo_frame_allocator.cpp
Fix a leak in the H.264 encoder.
[nageru] / pbo_frame_allocator.cpp
index 15fcb61d37b8cefad61df15f26b165796e91b528..1c370b4266d4f09609a8d657d1f8bda86fa1d85b 100644 (file)
@@ -1,5 +1,6 @@
 #include "pbo_frame_allocator.h"
 
+#include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <cstddef>
@@ -103,11 +104,16 @@ FrameAllocator::Frame PBOFrameAllocator::alloc_frame()
                freelist.pop();  // Meh.
        }
        vf.len = 0;
+       vf.overflow = 0;
        return vf;
 }
 
 void PBOFrameAllocator::release_frame(Frame frame)
 {
+       if (frame.overflow > 0) {
+               printf("%d bytes overflow after last (PBO) frame\n", int(frame.overflow));
+       }
+
        std::unique_lock<std::mutex> lock(freelist_mutex);
        freelist.push(frame);
        //--sumsum;