X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bmusb.h;h=4c7254bcb5dea6bb773381c510565cea37035839;hb=c753d698b047822c11f5f97b889649a3e582a4c9;hp=9ee6617a6e7874164a8a53603a47d974acf01694;hpb=a5e46ba4b478f7fae63f3032e574208c0e69cc11;p=bmusb diff --git a/bmusb.h b/bmusb.h index 9ee6617..4c7254b 100644 --- a/bmusb.h +++ b/bmusb.h @@ -177,6 +177,9 @@ class BMUSBCapture : public CaptureInterface { void set_video_frame_allocator(FrameAllocator *allocator) override { video_frame_allocator = allocator; + if (owned_video_frame_allocator.get() != allocator) { + owned_video_frame_allocator.reset(); + } } FrameAllocator *get_video_frame_allocator() override @@ -188,6 +191,9 @@ class BMUSBCapture : public CaptureInterface { void set_audio_frame_allocator(FrameAllocator *allocator) override { audio_frame_allocator = allocator; + if (owned_audio_frame_allocator.get() != allocator) { + owned_audio_frame_allocator.reset(); + } } FrameAllocator *get_audio_frame_allocator() override @@ -251,6 +257,8 @@ class BMUSBCapture : public CaptureInterface { FrameAllocator *video_frame_allocator = nullptr; FrameAllocator *audio_frame_allocator = nullptr; + std::unique_ptr owned_video_frame_allocator; + std::unique_ptr owned_audio_frame_allocator; frame_callback_t frame_callback = nullptr; std::thread dequeue_thread;