X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bmusb.h;fp=bmusb.h;h=4c7254bcb5dea6bb773381c510565cea37035839;hb=653fb04b1f7fd18a3361524aeb4877efca032cdb;hp=9ee6617a6e7874164a8a53603a47d974acf01694;hpb=b7e6e2e7df1bbae97a1b62112d9c8c67df212f44;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;