Commit cdcaa584 authored by Wim Taymans's avatar Wim Taymans

avdec: handle_frame should always unref the input frame

Unref the input frame in all cases. Previously it was only unreffed when the
frame was used for output.
When we produce an output frame, take an extra ref because the frame is now
freed elsewhere.
parent c9878e9f
......@@ -1091,7 +1091,7 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
/* get the output picture timing info again */
out_dframe = ffmpegdec->picture->opaque;
out_frame = out_dframe->frame;
out_frame = gst_video_codec_frame_ref (out_dframe->frame);
GST_DEBUG_OBJECT (ffmpegdec,
"pts %" G_GUINT64_FORMAT " duration %" G_GUINT64_FORMAT,
......@@ -1138,7 +1138,8 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
gst_video_decoder_finish_frame (GST_VIDEO_DECODER (ffmpegdec), out_frame);
beach:
GST_DEBUG_OBJECT (ffmpegdec, "return flow %d, len %d", *ret, len);
GST_DEBUG_OBJECT (ffmpegdec, "return flow %s, len %d",
gst_flow_get_name (*ret), len);
return len;
/* special cases */
......@@ -1352,6 +1353,7 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
GST_DEBUG_OBJECT (ffmpegdec, "Dropping %d bytes of data", bsize);
gst_buffer_unmap (frame->input_buffer, &minfo);
gst_video_codec_frame_unref (frame);
return ret;
}
......@@ -1448,8 +1450,8 @@ gst_ffmpegviddec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
avcodec_align_dimensions2 (ffmpegdec->context, &width, &height,
linesize_align);
edge =
ffmpegdec->
context->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width ();
ffmpegdec->context->
flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width ();
/* increase the size for the padding */
width += edge << 1;
height += edge << 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment