summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2020-06-29 12:39:08 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2020-07-02 12:21:51 -0400
commitd65f7de6507cc4183513194ab1c476f47d655562 (patch)
tree62a0826552009930f29ff16a0c9c313062c3a30c /sys
parent176a860169642acd4daea87c3058287600871328 (diff)
downloadgstreamer-plugins-bad-d65f7de6507cc4183513194ab1c476f47d655562.tar.gz
v4l2slh264dec: Factor out request wait
This will be reused to wait for previous slices to be complete when dealing with following slices (in slice decoding mode). Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2codecs/gstv4l2codech264dec.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/sys/v4l2codecs/gstv4l2codech264dec.c b/sys/v4l2codecs/gstv4l2codech264dec.c
index 718d68559..bcdb02fb7 100644
--- a/sys/v4l2codecs/gstv4l2codech264dec.c
+++ b/sys/v4l2codecs/gstv4l2codech264dec.c
@@ -813,13 +813,30 @@ fail:
return FALSE;
}
+static gboolean
+gst_v4l2_codec_h264_dec_wait (GstV4l2CodecH264Dec * self,
+ GstV4l2Request * request)
+{
+ gint ret = gst_v4l2_request_poll (request, GST_SECOND);
+ if (ret == 0) {
+ GST_ELEMENT_ERROR (self, STREAM, DECODE,
+ ("Decoding frame took too long"), (NULL));
+ return FALSE;
+ } else if (ret < 0) {
+ GST_ELEMENT_ERROR (self, STREAM, DECODE,
+ ("Decoding request failed: %s", g_strerror (errno)), (NULL));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static GstFlowReturn
gst_v4l2_codec_h264_dec_output_picture (GstH264Decoder * decoder,
GstH264Picture * picture)
{
GstV4l2CodecH264Dec *self = GST_V4L2_CODEC_H264_DEC (decoder);
GstV4l2Request *request = gst_h264_picture_get_user_data (picture);
- gint ret;
guint32 frame_num;
GstVideoCodecFrame *frame, *other_frame;
GstH264Picture *other_pic;
@@ -830,16 +847,8 @@ gst_v4l2_codec_h264_dec_output_picture (GstH264Decoder * decoder,
if (gst_v4l2_request_is_done (request))
goto finish_frame;
- ret = gst_v4l2_request_poll (request, GST_SECOND);
- if (ret == 0) {
- GST_ELEMENT_ERROR (self, STREAM, DECODE,
- ("Decoding frame took too long"), (NULL));
- return GST_FLOW_ERROR;
- } else if (ret < 0) {
- GST_ELEMENT_ERROR (self, STREAM, DECODE,
- ("Decoding request failed: %s", g_strerror (errno)), (NULL));
- return GST_FLOW_ERROR;
- }
+ if (!gst_v4l2_codec_h264_dec_wait (self, request))
+ return FALSE;
while (TRUE) {
if (!gst_v4l2_decoder_dequeue_src (self->decoder, &frame_num)) {