summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-01-20 10:02:48 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-01-20 10:12:50 +0200
commita08a53e2df8546a44bce6bc2b72e9084ffa8a16a (patch)
tree4f017205bf768dd7a0b28040abaa2b3aa9d1c2f7
parentfa7388c5c2692d1ca48fd5d82a28e0004bef7ceb (diff)
downloadgstreamer-plugins-good-a08a53e2df8546a44bce6bc2b72e9084ffa8a16a.tar.gz
vpxdec: Unref frame in all code paths of handle_frame()
https://bugzilla.gnome.org/show_bug.cgi?id=760666
-rw-r--r--ext/vpx/gstvp8dec.c12
-rw-r--r--ext/vpx/gstvp9dec.c12
2 files changed, 16 insertions, 8 deletions
diff --git a/ext/vpx/gstvp8dec.c b/ext/vpx/gstvp8dec.c
index c86cc4c9d..7ed9fa15f 100644
--- a/ext/vpx/gstvp8dec.c
+++ b/ext/vpx/gstvp8dec.c
@@ -438,12 +438,10 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame)
if (status != VPX_CODEC_OK) {
GST_WARNING_OBJECT (dec, "VPX preprocessing error: %s",
gst_vpx_error_name (status));
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (dec), frame);
return GST_FLOW_CUSTOM_SUCCESS_1;
}
if (!stream_info.is_kf) {
GST_WARNING_OBJECT (dec, "No keyframe, skipping");
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (dec), frame);
return GST_FLOW_CUSTOM_SUCCESS_1;
}
@@ -516,10 +514,13 @@ gst_vp8_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
if (!dec->decoder_inited) {
ret = open_codec (dec, frame);
- if (ret == GST_FLOW_CUSTOM_SUCCESS_1)
+ if (ret == GST_FLOW_CUSTOM_SUCCESS_1) {
+ gst_video_decoder_drop_frame (decoder, frame);
return GST_FLOW_OK;
- else if (ret != GST_FLOW_OK)
+ } else if (ret != GST_FLOW_OK) {
+ gst_video_codec_frame_unref (frame);
return ret;
+ }
}
deadline = gst_video_decoder_get_max_decode_time (decoder, frame);
@@ -533,6 +534,7 @@ gst_vp8_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
GST_ERROR_OBJECT (dec, "Failed to map input buffer");
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}
@@ -544,6 +546,7 @@ gst_vp8_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
if (status) {
GST_VIDEO_DECODER_ERROR (decoder, 1, LIBRARY, ENCODE,
("Failed to decode frame"), ("%s", gst_vpx_error_name (status)), ret);
+ gst_video_codec_frame_unref (frame);
return ret;
}
@@ -554,6 +557,7 @@ gst_vp8_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
GST_ELEMENT_ERROR (decoder, LIBRARY, ENCODE,
("Failed to decode frame"), ("Unsupported color format %d",
img->fmt));
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}
diff --git a/ext/vpx/gstvp9dec.c b/ext/vpx/gstvp9dec.c
index 3de5a6412..3a057ca8e 100644
--- a/ext/vpx/gstvp9dec.c
+++ b/ext/vpx/gstvp9dec.c
@@ -434,12 +434,10 @@ open_codec (GstVP9Dec * dec, GstVideoCodecFrame * frame)
if (status != VPX_CODEC_OK) {
GST_WARNING_OBJECT (dec, "VPX preprocessing error: %s",
gst_vpx_error_name (status));
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (dec), frame);
return GST_FLOW_CUSTOM_SUCCESS_1;
}
if (!stream_info.is_kf) {
GST_WARNING_OBJECT (dec, "No keyframe, skipping");
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (dec), frame);
return GST_FLOW_CUSTOM_SUCCESS_1;
}
@@ -507,10 +505,13 @@ gst_vp9_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
if (!dec->decoder_inited) {
ret = open_codec (dec, frame);
- if (ret == GST_FLOW_CUSTOM_SUCCESS_1)
+ if (ret == GST_FLOW_CUSTOM_SUCCESS_1) {
+ gst_video_decoder_drop_frame (decoder, frame);
return GST_FLOW_OK;
- else if (ret != GST_FLOW_OK)
+ } else if (ret != GST_FLOW_OK) {
+ gst_video_codec_frame_unref (frame);
return ret;
+ }
}
deadline = gst_video_decoder_get_max_decode_time (decoder, frame);
@@ -524,6 +525,7 @@ gst_vp9_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
GST_ERROR_OBJECT (dec, "Failed to map input buffer");
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}
@@ -535,6 +537,7 @@ gst_vp9_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
if (status) {
GST_VIDEO_DECODER_ERROR (decoder, 1, LIBRARY, ENCODE,
("Failed to decode frame"), ("%s", gst_vpx_error_name (status)), ret);
+ gst_video_codec_frame_unref (frame);
return ret;
}
@@ -560,6 +563,7 @@ gst_vp9_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
GST_ELEMENT_ERROR (decoder, LIBRARY, ENCODE,
("Failed to decode frame"), ("Unsupported color format %d",
img->fmt));
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
break;
}