mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 15:08:48 +00:00
codecs: Propagate downstream flow ERROR
Don't translate downstream flow ERROR to OK Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5024>
This commit is contained in:
parent
b45317e247
commit
45766f2448
6 changed files with 65 additions and 11 deletions
|
@ -676,6 +676,7 @@ gst_av1_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
GstBuffer *in_buf = frame->input_buffer;
|
GstBuffer *in_buf = frame->input_buffer;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstFlowReturn output_ret = GST_FLOW_OK;
|
||||||
guint32 total_consumed, consumed;
|
guint32 total_consumed, consumed;
|
||||||
GstAV1OBU obu;
|
GstAV1OBU obu;
|
||||||
GstAV1ParserResult res;
|
GstAV1ParserResult res;
|
||||||
|
@ -784,7 +785,13 @@ out:
|
||||||
gst_video_decoder_drop_frame (decoder, frame);
|
gst_video_decoder_drop_frame (decoder, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_av1_decoder_drain_output_queue (self, priv->preferred_output_delay, &ret);
|
gst_av1_decoder_drain_output_queue (self,
|
||||||
|
priv->preferred_output_delay, &output_ret);
|
||||||
|
if (output_ret != GST_FLOW_OK) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Output returned %s", gst_flow_get_name (output_ret));
|
||||||
|
return output_ret;
|
||||||
|
}
|
||||||
|
|
||||||
priv->current_picture = NULL;
|
priv->current_picture = NULL;
|
||||||
priv->current_frame = NULL;
|
priv->current_frame = NULL;
|
||||||
|
|
|
@ -150,6 +150,9 @@ struct _GstH264DecoderPrivate
|
||||||
GstQueueArray *output_queue;
|
GstQueueArray *output_queue;
|
||||||
|
|
||||||
gboolean input_state_changed;
|
gboolean input_state_changed;
|
||||||
|
|
||||||
|
/* Return value from output_picture() */
|
||||||
|
GstFlowReturn last_flow;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -416,6 +419,7 @@ gst_h264_decoder_reset (GstH264Decoder * self)
|
||||||
priv->width = 0;
|
priv->width = 0;
|
||||||
priv->height = 0;
|
priv->height = 0;
|
||||||
priv->nal_length_size = 4;
|
priv->nal_length_size = 4;
|
||||||
|
priv->last_flow = GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -526,6 +530,7 @@ gst_h264_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
GST_TIME_ARGS (GST_BUFFER_DTS (in_buf)));
|
GST_TIME_ARGS (GST_BUFFER_DTS (in_buf)));
|
||||||
|
|
||||||
priv->current_frame = frame;
|
priv->current_frame = frame;
|
||||||
|
priv->last_flow = GST_FLOW_OK;
|
||||||
|
|
||||||
gst_buffer_map (in_buf, &map, GST_MAP_READ);
|
gst_buffer_map (in_buf, &map, GST_MAP_READ);
|
||||||
if (priv->in_format == GST_H264_DECODER_FORMAT_AVC) {
|
if (priv->in_format == GST_H264_DECODER_FORMAT_AVC) {
|
||||||
|
@ -576,6 +581,12 @@ gst_h264_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
gst_video_codec_frame_unref (frame);
|
gst_video_codec_frame_unref (frame);
|
||||||
priv->current_frame = NULL;
|
priv->current_frame = NULL;
|
||||||
|
|
||||||
|
if (priv->last_flow != GST_FLOW_OK) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Last flow %s", gst_flow_get_name (priv->last_flow));
|
||||||
|
return priv->last_flow;
|
||||||
|
}
|
||||||
|
|
||||||
if (decode_ret == GST_FLOW_ERROR) {
|
if (decode_ret == GST_FLOW_ERROR) {
|
||||||
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||||
("Failed to decode data"), (NULL), decode_ret);
|
("Failed to decode data"), (NULL), decode_ret);
|
||||||
|
@ -1768,7 +1779,6 @@ gst_h264_decoder_do_output_picture (GstH264Decoder * self,
|
||||||
GstH264DecoderPrivate *priv = self->priv;
|
GstH264DecoderPrivate *priv = self->priv;
|
||||||
GstVideoCodecFrame *frame = NULL;
|
GstVideoCodecFrame *frame = NULL;
|
||||||
GstH264DecoderOutputFrame output_frame;
|
GstH264DecoderOutputFrame output_frame;
|
||||||
GstFlowReturn flow_ret = GST_FLOW_OK;
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
guint32 last_output_poc;
|
guint32 last_output_poc;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1813,8 +1823,7 @@ gst_h264_decoder_do_output_picture (GstH264Decoder * self,
|
||||||
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
||||||
|
|
||||||
gst_h264_decoder_drain_output_queue (self, priv->preferred_output_delay,
|
gst_h264_decoder_drain_output_queue (self, priv->preferred_output_delay,
|
||||||
&flow_ret);
|
&priv->last_flow);
|
||||||
UPDATE_FLOW_RETURN (ret, flow_ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -136,6 +136,8 @@ struct _GstH265DecoderPrivate
|
||||||
GstQueueArray *output_queue;
|
GstQueueArray *output_queue;
|
||||||
|
|
||||||
gboolean input_state_changed;
|
gboolean input_state_changed;
|
||||||
|
|
||||||
|
GstFlowReturn last_flow;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -267,6 +269,7 @@ gst_h265_decoder_start (GstVideoDecoder * decoder)
|
||||||
priv->dpb = gst_h265_dpb_new ();
|
priv->dpb = gst_h265_dpb_new ();
|
||||||
priv->new_bitstream = TRUE;
|
priv->new_bitstream = TRUE;
|
||||||
priv->prev_nal_is_eos = FALSE;
|
priv->prev_nal_is_eos = FALSE;
|
||||||
|
priv->last_flow = GST_FLOW_OK;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1696,7 +1699,6 @@ gst_h265_decoder_do_output_picture (GstH265Decoder * self,
|
||||||
GstH265DecoderPrivate *priv = self->priv;
|
GstH265DecoderPrivate *priv = self->priv;
|
||||||
GstVideoCodecFrame *frame = NULL;
|
GstVideoCodecFrame *frame = NULL;
|
||||||
GstH265DecoderOutputFrame output_frame;
|
GstH265DecoderOutputFrame output_frame;
|
||||||
GstFlowReturn flow_ret = GST_FLOW_OK;
|
|
||||||
|
|
||||||
g_assert (ret != NULL);
|
g_assert (ret != NULL);
|
||||||
|
|
||||||
|
@ -1730,8 +1732,7 @@ gst_h265_decoder_do_output_picture (GstH265Decoder * self,
|
||||||
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
||||||
|
|
||||||
gst_h265_decoder_drain_output_queue (self, priv->preferred_output_delay,
|
gst_h265_decoder_drain_output_queue (self, priv->preferred_output_delay,
|
||||||
&flow_ret);
|
&priv->last_flow);
|
||||||
UPDATE_FLOW_RETURN (ret, flow_ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1791,7 +1792,7 @@ gst_h265_decoder_dpb_init (GstH265Decoder * self, const GstH265Slice * slice,
|
||||||
if (slice->clear_dpb) {
|
if (slice->clear_dpb) {
|
||||||
if (picture->NoOutputOfPriorPicsFlag) {
|
if (picture->NoOutputOfPriorPicsFlag) {
|
||||||
GST_DEBUG_OBJECT (self, "Clear dpb");
|
GST_DEBUG_OBJECT (self, "Clear dpb");
|
||||||
gst_h265_decoder_drain_output_queue (self, 0, &ret);
|
gst_h265_decoder_drain_output_queue (self, 0, &priv->last_flow);
|
||||||
gst_h265_decoder_clear_dpb (self, FALSE);
|
gst_h265_decoder_clear_dpb (self, FALSE);
|
||||||
} else {
|
} else {
|
||||||
gst_h265_dpb_delete_unused (priv->dpb);
|
gst_h265_dpb_delete_unused (priv->dpb);
|
||||||
|
@ -1999,6 +2000,7 @@ gst_h265_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
|
|
||||||
gst_h265_decoder_reset_frame_state (self);
|
gst_h265_decoder_reset_frame_state (self);
|
||||||
|
|
||||||
|
priv->last_flow = GST_FLOW_OK;
|
||||||
priv->current_frame = frame;
|
priv->current_frame = frame;
|
||||||
|
|
||||||
if (!gst_buffer_map (in_buf, &map, GST_MAP_READ)) {
|
if (!gst_buffer_map (in_buf, &map, GST_MAP_READ)) {
|
||||||
|
@ -2080,6 +2082,12 @@ gst_h265_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
gst_video_decoder_release_frame (decoder, frame);
|
gst_video_decoder_release_frame (decoder, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (priv->last_flow != GST_FLOW_OK) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Last flow %s", gst_flow_get_name (priv->last_flow));
|
||||||
|
return priv->last_flow;
|
||||||
|
}
|
||||||
|
|
||||||
if (decode_ret == GST_FLOW_ERROR) {
|
if (decode_ret == GST_FLOW_ERROR) {
|
||||||
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||||
("Failed to decode data"), (NULL), decode_ret);
|
("Failed to decode data"), (NULL), decode_ret);
|
||||||
|
|
|
@ -269,6 +269,8 @@ struct _GstMpeg2DecoderPrivate
|
||||||
gboolean is_live;
|
gboolean is_live;
|
||||||
|
|
||||||
gboolean input_state_changed;
|
gboolean input_state_changed;
|
||||||
|
|
||||||
|
GstFlowReturn last_flow;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define UPDATE_FLOW_RETURN(ret,new_ret) G_STMT_START { \
|
#define UPDATE_FLOW_RETURN(ret,new_ret) G_STMT_START { \
|
||||||
|
@ -352,6 +354,7 @@ gst_mpeg2_decoder_start (GstVideoDecoder * decoder)
|
||||||
priv->dpb = gst_mpeg2_dpb_new ();
|
priv->dpb = gst_mpeg2_dpb_new ();
|
||||||
priv->profile = -1;
|
priv->profile = -1;
|
||||||
priv->progressive = TRUE;
|
priv->progressive = TRUE;
|
||||||
|
priv->last_flow = GST_FLOW_OK;
|
||||||
|
|
||||||
priv->output_queue =
|
priv->output_queue =
|
||||||
gst_queue_array_new_for_struct (sizeof (GstMpeg2DecoderOutputFrame), 1);
|
gst_queue_array_new_for_struct (sizeof (GstMpeg2DecoderOutputFrame), 1);
|
||||||
|
@ -1170,7 +1173,7 @@ gst_mpeg2_decoder_do_output_picture (GstMpeg2Decoder * decoder,
|
||||||
output_frame.self = decoder;
|
output_frame.self = decoder;
|
||||||
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
||||||
gst_mpeg2_decoder_drain_output_queue (decoder, priv->preferred_output_delay,
|
gst_mpeg2_decoder_drain_output_queue (decoder, priv->preferred_output_delay,
|
||||||
ret);
|
&priv->last_flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -1244,6 +1247,7 @@ gst_mpeg2_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
GST_TIME_ARGS (GST_BUFFER_DTS (in_buf)), frame->system_frame_number);
|
GST_TIME_ARGS (GST_BUFFER_DTS (in_buf)), frame->system_frame_number);
|
||||||
|
|
||||||
priv->state &= ~GST_MPEG2_DECODER_STATE_GOT_SLICE;
|
priv->state &= ~GST_MPEG2_DECODER_STATE_GOT_SLICE;
|
||||||
|
priv->last_flow = GST_FLOW_OK;
|
||||||
|
|
||||||
priv->current_frame = frame;
|
priv->current_frame = frame;
|
||||||
gst_buffer_map (in_buf, &map_info, GST_MAP_READ);
|
gst_buffer_map (in_buf, &map_info, GST_MAP_READ);
|
||||||
|
@ -1294,6 +1298,18 @@ gst_mpeg2_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
gst_clear_mpeg2_picture (&priv->first_field);
|
gst_clear_mpeg2_picture (&priv->first_field);
|
||||||
gst_video_codec_frame_unref (priv->current_frame);
|
gst_video_codec_frame_unref (priv->current_frame);
|
||||||
priv->current_frame = NULL;
|
priv->current_frame = NULL;
|
||||||
|
|
||||||
|
if (priv->last_flow != GST_FLOW_OK) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Last flow %s", gst_flow_get_name (priv->last_flow));
|
||||||
|
return priv->last_flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == GST_FLOW_ERROR) {
|
||||||
|
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||||
|
("Failed to decode data"), (NULL), ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
|
|
@ -375,6 +375,7 @@ gst_vp8_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
GstVp8ParserResult pres;
|
GstVp8ParserResult pres;
|
||||||
GstVp8Picture *picture = NULL;
|
GstVp8Picture *picture = NULL;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstFlowReturn output_ret = GST_FLOW_OK;
|
||||||
GstVp8DecoderOutputFrame output_frame;
|
GstVp8DecoderOutputFrame output_frame;
|
||||||
|
|
||||||
GST_LOG_OBJECT (self,
|
GST_LOG_OBJECT (self,
|
||||||
|
@ -483,7 +484,13 @@ gst_vp8_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_vp8_decoder_drain_output_queue (self, priv->preferred_output_delay, &ret);
|
gst_vp8_decoder_drain_output_queue (self, priv->preferred_output_delay,
|
||||||
|
&output_ret);
|
||||||
|
if (output_ret != GST_FLOW_OK) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Output returned %s", gst_flow_get_name (output_ret));
|
||||||
|
return output_ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == GST_FLOW_ERROR) {
|
if (ret == GST_FLOW_ERROR) {
|
||||||
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||||
|
|
|
@ -377,6 +377,7 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
GstVp9ParserResult pres;
|
GstVp9ParserResult pres;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstFlowReturn output_ret = GST_FLOW_OK;
|
||||||
gboolean intra_only = FALSE;
|
gboolean intra_only = FALSE;
|
||||||
gboolean check_codec_change = FALSE;
|
gboolean check_codec_change = FALSE;
|
||||||
GstVp9DecoderOutputFrame output_frame;
|
GstVp9DecoderOutputFrame output_frame;
|
||||||
|
@ -561,7 +562,13 @@ gst_vp9_decoder_handle_frame (GstVideoDecoder * decoder,
|
||||||
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
gst_queue_array_push_tail_struct (priv->output_queue, &output_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_vp9_decoder_drain_output_queue (self, priv->preferred_output_delay, &ret);
|
gst_vp9_decoder_drain_output_queue (self,
|
||||||
|
priv->preferred_output_delay, &output_ret);
|
||||||
|
if (output_ret != GST_FLOW_OK) {
|
||||||
|
GST_DEBUG_OBJECT (self,
|
||||||
|
"Output returned %s", gst_flow_get_name (output_ret));
|
||||||
|
return output_ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == GST_FLOW_ERROR) {
|
if (ret == GST_FLOW_ERROR) {
|
||||||
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
GST_VIDEO_DECODER_ERROR (self, 1, STREAM, DECODE,
|
||||||
|
|
Loading…
Reference in a new issue