Commit a2eb1b57 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2slh264dec: Wait on previous pending request in slice mode

In slice mode, we'll do one request per slice. In order to recycle
bitstream buffer, and not run-out, wait for the last pending
request to complete and mark it done.

We only wait after having queued the current slice in order to reduce
that potential driver starvation and maintain performance (using dual

Part-of: <!1395>
parent b20c6fe6
......@@ -948,7 +948,7 @@ gst_v4l2_codec_h264_dec_submit_bitstream (GstV4l2CodecH264Dec * self,
GstH264Picture * picture, guint flags)
GstVideoCodecFrame *frame;
GstV4l2Request *request;
GstV4l2Request *prev_request, *request;
gsize bytesused;
gboolean ret = FALSE;
......@@ -990,8 +990,6 @@ gst_v4l2_codec_h264_dec_submit_bitstream (GstV4l2CodecH264Dec * self,
goto done;
gst_h264_picture_set_user_data (picture, request,
(GDestroyNotify) gst_v4l2_request_free);
frame = gst_video_decoder_get_frame (GST_VIDEO_DECODER (self),
......@@ -1026,10 +1024,22 @@ gst_v4l2_codec_h264_dec_submit_bitstream (GstV4l2CodecH264Dec * self,
goto done;
prev_request = gst_h264_picture_get_user_data (picture);
if (prev_request) {
if (!gst_v4l2_codec_h264_dec_wait (self, prev_request))
goto done;
gst_v4l2_request_set_done (prev_request);
gst_h264_picture_set_user_data (picture, g_steal_pointer (&request),
(GDestroyNotify) gst_v4l2_request_free);
ret = TRUE;
if (request)
gst_v4l2_request_free (request);
gst_v4l2_codec_h264_dec_reset_picture (self);
return ret;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment