msdkdec: set lockable flag

When postpone_free_surface is TRUE, the output buffer is not writable,
however the base decoder needs a writable buffer as output buffer,
otherwise it will make a copy of the output buffer. As the underlying
memory is always lockable, so we may set the LOCKABLE flag for this buffer
to avoid buffer copy in the base class.

The refcount of the output buffer is 1 when postpone_free_surface is
FALSE, so needn't set the LOCKABLE flag for this case.
This commit is contained in:
Haihao Xiang 2019-09-26 09:52:14 +08:00 committed by Víctor Manuel Jáquez Leal
parent 83100b3504
commit 71ff8236b5

View file

@ -140,6 +140,10 @@ allocate_output_buffer (GstMsdkDec * thiz, GstBuffer ** buffer)
*buffer = gst_buffer_ref (frame->output_buffer);
gst_buffer_replace (&frame->output_buffer, NULL);
gst_video_codec_frame_unref (frame);
if (thiz->postpone_free_surface)
GST_MINI_OBJECT_FLAG_SET (*buffer, GST_MINI_OBJECT_FLAG_LOCKABLE);
return GST_FLOW_OK;
}