summaryrefslogtreecommitdiff
path: root/ext/openh264
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-07-02 18:51:09 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-07-02 18:51:44 +0200
commit9e7454a90abe7ea6075e3bcaa0731ed4a8a22b54 (patch)
tree4d649f009be55ef95f6d9b060a81c479f8a5c027 /ext/openh264
parentf037b28a7b6e3bc52d45c1ab32c2ae33edca6f35 (diff)
downloadgstreamer-plugins-bad-9e7454a90abe7ea6075e3bcaa0731ed4a8a22b54.tar.gz
openh264dec: Unref video frames and codec state in all cases
Diffstat (limited to 'ext/openh264')
-rw-r--r--ext/openh264/gstopenh264dec.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/openh264/gstopenh264dec.cpp b/ext/openh264/gstopenh264dec.cpp
index 3e37d01ac..6333fe497 100644
--- a/ext/openh264/gstopenh264dec.cpp
+++ b/ext/openh264/gstopenh264dec.cpp
@@ -271,6 +271,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
if (frame) {
if (!gst_buffer_map (frame->input_buffer, &map_info, GST_MAP_READ)) {
GST_ERROR_OBJECT (openh264dec, "Cannot map input buffer!");
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}
@@ -305,8 +306,10 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
ret =
openh264dec->priv->decoder->DecodeFrame2 (NULL, 0, yuvdata,
&dst_buf_info);
- if (ret != dsErrorFree)
+ if (ret != dsErrorFree) {
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_EOS;
+ }
}
/* FIXME: openh264 has no way for us to get a connection
@@ -321,6 +324,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
/* No output available yet */
if (dst_buf_info.iBufferStatus != 1) {
+ gst_video_codec_frame_unref (frame);
return (frame ? GST_FLOW_OK : GST_FLOW_EOS);
}
@@ -339,6 +343,8 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
if (!gst_video_decoder_negotiate (decoder)) {
GST_ERROR_OBJECT (openh264dec,
"Failed to negotiate with downstream elements");
+ gst_video_codec_state_unref (state);
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_NOT_NEGOTIATED;
}
} else {
@@ -348,6 +354,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
flow_status = gst_video_decoder_allocate_output_frame (decoder, frame);
if (flow_status != GST_FLOW_OK) {
gst_video_codec_state_unref (state);
+ gst_video_codec_frame_unref (frame);
return flow_status;
}
@@ -355,6 +362,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
GST_MAP_WRITE)) {
GST_ERROR_OBJECT (openh264dec, "Cannot map output buffer!");
gst_video_codec_state_unref (state);
+ gst_video_codec_frame_unref (frame);
return GST_FLOW_ERROR;
}