check_error();
set_clamp_to_edge();
if (field == 0) {
- if (global_flags.can_disable_srgb_decoder) { // See the comments in tweaked_inputs.h.
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
- } else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
- }
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
check_error();
}
break;
}
#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<mutex> lock(freelist_mutex);
freelist.push(frame);
//--sumsum;