qsv: Fix encoding error when input memory belongs to other GPU

Copy frame if VA display of input buffer is different from that
of encoder, like we've been doing on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3335>
This commit is contained in:
Seungha Yang 2022-11-05 00:00:43 +09:00 committed by GStreamer Marge Bot
parent 04581fad6a
commit e1e9ee5506

View file

@ -87,15 +87,17 @@ static GstBuffer *
gst_qsv_va_allocator_upload (GstQsvAllocator * allocator,
const GstVideoInfo * info, GstBuffer * buffer, GstBufferPool * pool)
{
GstQsvVaAllocator *self = GST_QSV_VA_ALLOCATOR (allocator);
GstVideoFrame src_frame, dst_frame;
VASurfaceID surface;
GstBuffer *dst_buf;
GstFlowReturn ret;
/* TODO: handle buffer from different VA display */
surface = gst_va_buffer_get_surface (buffer);
if (surface != VA_INVALID_ID)
if (surface != VA_INVALID_ID && gst_va_buffer_peek_display (buffer) ==
self->display) {
return gst_buffer_ref (buffer);
}
ret = gst_buffer_pool_acquire_buffer (pool, &dst_buf, nullptr);
if (ret != GST_FLOW_OK) {