summaryrefslogtreecommitdiff
path: root/ext/mpeg2dec
diff options
context:
space:
mode:
authorEdward Hervey <edward.hervey@collabora.co.uk>2012-07-19 09:58:50 +0200
committerEdward Hervey <edward.hervey@collabora.co.uk>2012-07-19 10:00:32 +0200
commit89ff56321f6306f279c7791f131615913357dea7 (patch)
treeb005b58e09bb28469c49bedd96ea30a3d831312e /ext/mpeg2dec
parente0a5d6de601686dfc496b25b0b96c0996f0d202f (diff)
downloadgstreamer-plugins-ugly-89ff56321f6306f279c7791f131615913357dea7.tar.gz
mpeg2dec: Propagate GstFlowReturn where needed
It was just ignoring the return values...
Diffstat (limited to 'ext/mpeg2dec')
-rw-r--r--ext/mpeg2dec/gstmpeg2dec.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/ext/mpeg2dec/gstmpeg2dec.c b/ext/mpeg2dec/gstmpeg2dec.c
index 6d82676f..07cd14c4 100644
--- a/ext/mpeg2dec/gstmpeg2dec.c
+++ b/ext/mpeg2dec/gstmpeg2dec.c
@@ -331,17 +331,12 @@ gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstVideoCodecFrame * in_frame,
ret =
gst_video_decoder_alloc_output_frame (GST_VIDEO_DECODER (dec), in_frame);
- if (ret != GST_FLOW_OK) {
- gst_video_codec_state_unref (state);
- return ret;
- }
+ if (ret != GST_FLOW_OK)
+ goto beach;
if (!gst_video_frame_map (&output_frame, info, in_frame->output_buffer,
- GST_MAP_WRITE)) {
- GST_ERROR_OBJECT (dec, "Failed to map output frame");
- gst_video_codec_state_unref (state);
- return GST_FLOW_ERROR;
- }
+ GST_MAP_WRITE))
+ goto map_fail;
n_planes = GST_VIDEO_FRAME_N_PLANES (&output_frame);
for (c = 0; c < n_planes; c++) {
@@ -369,9 +364,17 @@ gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstVideoCodecFrame * in_frame,
gst_video_frame_unmap (&output_frame);
+beach:
gst_video_codec_state_unref (state);
- return GST_FLOW_OK;
+ return ret;
+
+map_fail:
+ {
+ GST_ERROR_OBJECT (dec, "Failed to map output frame");
+ gst_video_codec_state_unref (state);
+ return GST_FLOW_ERROR;
+ }
}
static void
@@ -799,7 +802,7 @@ handle_picture (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info,
break;
default:
gst_video_codec_frame_ref (frame);
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
+ ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
GST_VIDEO_DECODER_ERROR (mpeg2dec, 1, STREAM, DECODE,
("decoding error"), ("Invalid picture type"), ret);
return ret;
@@ -875,16 +878,16 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
if (picture->flags & PIC_FLAG_SKIP) {
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer because of skip flag");
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
+ ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
mpeg2_skip (mpeg2dec->decoder, 1);
- return GST_FLOW_OK;
+ return ret;
}
if (mpeg2dec->discont_state != MPEG2DEC_DISC_NONE) {
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer, discont state %d",
mpeg2dec->discont_state);
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
- return GST_FLOW_OK;
+ ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
+ return ret;
}
state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (mpeg2dec));
@@ -896,9 +899,8 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
if (gst_video_decoder_get_max_decode_time (GST_VIDEO_DECODER (mpeg2dec),
frame) < 0) {
GST_DEBUG_OBJECT (mpeg2dec, "dropping buffer crop, too late");
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
- gst_video_codec_state_unref (state);
- return GST_FLOW_OK;
+ ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
+ goto beach;
}
GST_DEBUG_OBJECT (mpeg2dec, "cropping buffer");
@@ -907,9 +909,10 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
ret = gst_mpeg2dec_crop_buffer (mpeg2dec, frame, vframe);
}
- gst_video_codec_state_unref (state);
- gst_video_decoder_finish_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
+ ret = gst_video_decoder_finish_frame (GST_VIDEO_DECODER (mpeg2dec), frame);
+beach:
+ gst_video_codec_state_unref (state);
return ret;
}