mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
openh264dec: Unref video frames and codec state in all cases
This commit is contained in:
parent
f037b28a7b
commit
9e7454a90a
1 changed files with 9 additions and 1 deletions
|
@ -271,6 +271,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
|
||||||
if (frame) {
|
if (frame) {
|
||||||
if (!gst_buffer_map (frame->input_buffer, &map_info, GST_MAP_READ)) {
|
if (!gst_buffer_map (frame->input_buffer, &map_info, GST_MAP_READ)) {
|
||||||
GST_ERROR_OBJECT (openh264dec, "Cannot map input buffer!");
|
GST_ERROR_OBJECT (openh264dec, "Cannot map input buffer!");
|
||||||
|
gst_video_codec_frame_unref (frame);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,8 +306,10 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
|
||||||
ret =
|
ret =
|
||||||
openh264dec->priv->decoder->DecodeFrame2 (NULL, 0, yuvdata,
|
openh264dec->priv->decoder->DecodeFrame2 (NULL, 0, yuvdata,
|
||||||
&dst_buf_info);
|
&dst_buf_info);
|
||||||
if (ret != dsErrorFree)
|
if (ret != dsErrorFree) {
|
||||||
|
gst_video_codec_frame_unref (frame);
|
||||||
return GST_FLOW_EOS;
|
return GST_FLOW_EOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: openh264 has no way for us to get a connection
|
/* 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 */
|
/* No output available yet */
|
||||||
if (dst_buf_info.iBufferStatus != 1) {
|
if (dst_buf_info.iBufferStatus != 1) {
|
||||||
|
gst_video_codec_frame_unref (frame);
|
||||||
return (frame ? GST_FLOW_OK : GST_FLOW_EOS);
|
return (frame ? GST_FLOW_OK : GST_FLOW_EOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +343,8 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
|
||||||
if (!gst_video_decoder_negotiate (decoder)) {
|
if (!gst_video_decoder_negotiate (decoder)) {
|
||||||
GST_ERROR_OBJECT (openh264dec,
|
GST_ERROR_OBJECT (openh264dec,
|
||||||
"Failed to negotiate with downstream elements");
|
"Failed to negotiate with downstream elements");
|
||||||
|
gst_video_codec_state_unref (state);
|
||||||
|
gst_video_codec_frame_unref (frame);
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,6 +354,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
|
||||||
flow_status = gst_video_decoder_allocate_output_frame (decoder, frame);
|
flow_status = gst_video_decoder_allocate_output_frame (decoder, frame);
|
||||||
if (flow_status != GST_FLOW_OK) {
|
if (flow_status != GST_FLOW_OK) {
|
||||||
gst_video_codec_state_unref (state);
|
gst_video_codec_state_unref (state);
|
||||||
|
gst_video_codec_frame_unref (frame);
|
||||||
return flow_status;
|
return flow_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,6 +362,7 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder,
|
||||||
GST_MAP_WRITE)) {
|
GST_MAP_WRITE)) {
|
||||||
GST_ERROR_OBJECT (openh264dec, "Cannot map output buffer!");
|
GST_ERROR_OBJECT (openh264dec, "Cannot map output buffer!");
|
||||||
gst_video_codec_state_unref (state);
|
gst_video_codec_state_unref (state);
|
||||||
|
gst_video_codec_frame_unref (frame);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue