mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
v4l2codecs: Detect missing M2M_HOLD_CAPTURE_BUF
Produce an error if we try to use the feature of holding capture buffer but it is not supported by the driver. Ingoring this can lead to stalls as the driver will run-out of capture buffer to decode into. This affects slice decoders but also split-field interlaced decoding. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
This commit is contained in:
parent
efa360ce82
commit
c9d8b8a972
1 changed files with 19 additions and 0 deletions
|
@ -87,6 +87,9 @@ struct _GstV4l2Decoder
|
|||
gchar *media_device;
|
||||
gchar *video_device;
|
||||
guint render_delay;
|
||||
|
||||
/* detected features */
|
||||
gboolean supports_holding_capture;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GstV4l2Decoder, gst_v4l2_decoder, GST_TYPE_OBJECT,
|
||||
|
@ -488,6 +491,13 @@ gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (direction == GST_PAD_SINK) {
|
||||
if (reqbufs.capabilities & V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF)
|
||||
self->supports_holding_capture = TRUE;
|
||||
else
|
||||
self->supports_holding_capture = FALSE;
|
||||
}
|
||||
|
||||
return reqbufs.count;
|
||||
}
|
||||
|
||||
|
@ -1086,6 +1096,15 @@ gst_v4l2_request_queue (GstV4l2Request * request, guint flags)
|
|||
|
||||
GST_TRACE_OBJECT (decoder, "Queuing request %i.", request->fd);
|
||||
|
||||
/* this would lead to stalls if we tried to use this feature and it wasn't
|
||||
* supported. */
|
||||
if ((flags & V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF)
|
||||
&& !decoder->supports_holding_capture) {
|
||||
GST_ERROR_OBJECT (decoder,
|
||||
"Driver does not support holding capture buffer.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_v4l2_decoder_queue_sink_mem (decoder, request,
|
||||
request->bitstream, request->frame_num, flags)) {
|
||||
GST_ERROR_OBJECT (decoder, "Driver did not accept the bitstream data.");
|
||||
|
|
Loading…
Reference in a new issue