mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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>
This commit is contained in:
parent
176a860169
commit
d65f7de650
1 changed files with 20 additions and 11 deletions
|
@ -813,13 +813,30 @@ fail:
|
||||||
return FALSE;
|
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
|
static GstFlowReturn
|
||||||
gst_v4l2_codec_h264_dec_output_picture (GstH264Decoder * decoder,
|
gst_v4l2_codec_h264_dec_output_picture (GstH264Decoder * decoder,
|
||||||
GstH264Picture * picture)
|
GstH264Picture * picture)
|
||||||
{
|
{
|
||||||
GstV4l2CodecH264Dec *self = GST_V4L2_CODEC_H264_DEC (decoder);
|
GstV4l2CodecH264Dec *self = GST_V4L2_CODEC_H264_DEC (decoder);
|
||||||
GstV4l2Request *request = gst_h264_picture_get_user_data (picture);
|
GstV4l2Request *request = gst_h264_picture_get_user_data (picture);
|
||||||
gint ret;
|
|
||||||
guint32 frame_num;
|
guint32 frame_num;
|
||||||
GstVideoCodecFrame *frame, *other_frame;
|
GstVideoCodecFrame *frame, *other_frame;
|
||||||
GstH264Picture *other_pic;
|
GstH264Picture *other_pic;
|
||||||
|
@ -830,16 +847,8 @@ gst_v4l2_codec_h264_dec_output_picture (GstH264Decoder * decoder,
|
||||||
if (gst_v4l2_request_is_done (request))
|
if (gst_v4l2_request_is_done (request))
|
||||||
goto finish_frame;
|
goto finish_frame;
|
||||||
|
|
||||||
ret = gst_v4l2_request_poll (request, GST_SECOND);
|
if (!gst_v4l2_codec_h264_dec_wait (self, request))
|
||||||
if (ret == 0) {
|
return FALSE;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (!gst_v4l2_decoder_dequeue_src (self->decoder, &frame_num)) {
|
if (!gst_v4l2_decoder_dequeue_src (self->decoder, &frame_num)) {
|
||||||
|
|
Loading…
Reference in a new issue