jpegdec: fix frame leaks in handle_frame() implementation

handle_frame() is supposed to consume @frame, so if we don't call
gst_video_decoder_drop_frame() or gst_video_decoder_finish_frame() we have to
release it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=748909
This commit is contained in:
Guillaume Desmottes 2015-05-04 19:26:14 +02:00 committed by Nicolas Dufresne
parent 9865730cfa
commit 1421fc558e

View file

@ -994,6 +994,7 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
guint code, hdr_ok;
gboolean need_unmap = TRUE;
GstVideoCodecState *state = NULL;
gboolean release_frame = TRUE;
dec->current_frame = frame;
gst_buffer_map (frame->input_buffer, &dec->current_frame_map, GST_MAP_READ);
@ -1141,6 +1142,7 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
gst_buffer_unmap (frame->input_buffer, &dec->current_frame_map);
ret = gst_video_decoder_finish_frame (bdec, frame);
release_frame = FALSE;
need_unmap = FALSE;
done:
@ -1150,6 +1152,9 @@ exit:
if (need_unmap)
gst_buffer_unmap (frame->input_buffer, &dec->current_frame_map);
if (release_frame)
gst_video_decoder_release_frame (bdec, frame);
if (state)
gst_video_codec_state_unref (state);
@ -1183,6 +1188,7 @@ decode_error:
gst_buffer_unmap (frame->input_buffer, &dec->current_frame_map);
gst_video_decoder_drop_frame (bdec, frame);
release_frame = FALSE;
need_unmap = FALSE;
jpeg_abort_decompress (&dec->cinfo);