X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fpbo_frame_allocator.cpp;fp=nageru%2Fpbo_frame_allocator.cpp;h=7fb06f849b1bff09c78be68ad9b388ff1cd8c7e9;hb=23da824e1d61e37fbe0cc1c0f4d32052022a50ba;hp=54182a83a899fa3ca9994974a76316c90e812d4d;hpb=3ebd09c3607db65e9eb7a5ff77b76ab709c9ec0f;p=nageru diff --git a/nageru/pbo_frame_allocator.cpp b/nageru/pbo_frame_allocator.cpp index 54182a8..7fb06f8 100644 --- a/nageru/pbo_frame_allocator.cpp +++ b/nageru/pbo_frame_allocator.cpp @@ -370,6 +370,21 @@ void PBOFrameAllocator::release_frame(Frame frame) } #endif + { + // In case we never got to upload the frame to MJPEGEncoder. + Userdata *userdata = (Userdata *)frame.userdata; + MJPEGEncoder::VAResources resources __attribute__((unused)) = move(userdata->va_resources); + MJPEGEncoder::ReleaseVAResources release = move(userdata->va_resources_release); + + if (frame.data_copy != nullptr && userdata->data_copy_current_src == Userdata::FROM_VA_API) { + VADisplay va_dpy = mjpeg_encoder->va_dpy->va_dpy; + VAStatus va_status = vaUnmapBuffer(va_dpy, resources.image.buf); + CHECK_VASTATUS(va_status, "vaUnmapBuffer"); + + frame.data_copy = nullptr; + } + } + lock_guard lock(freelist_mutex); freelist.push(frame); //--sumsum;