mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
closedcaption: fix leak in line21 decoder
Destroy old decoder instance when shutting down the element, and also in case the input format changes. Fix harness/pipeline leak in unit test.
This commit is contained in:
parent
2ab238a4d0
commit
6dad8b7c78
2 changed files with 17 additions and 1 deletions
|
@ -53,6 +53,7 @@ G_DEFINE_TYPE (GstLine21Decoder, gst_line_21_decoder, GST_TYPE_VIDEO_FILTER);
|
|||
#define parent_class gst_line_21_decoder_parent_class
|
||||
|
||||
static void gst_line_21_decoder_finalize (GObject * self);
|
||||
static gboolean gst_line_21_decoder_stop (GstBaseTransform * btrans);
|
||||
static gboolean gst_line_21_decoder_set_info (GstVideoFilter * filter,
|
||||
GstCaps * incaps, GstVideoInfo * in_info,
|
||||
GstCaps * outcaps, GstVideoInfo * out_info);
|
||||
|
@ -85,6 +86,7 @@ gst_line_21_decoder_class_init (GstLine21DecoderClass * klass)
|
|||
gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
|
||||
|
||||
transform_class->stop = gst_line_21_decoder_stop;
|
||||
transform_class->prepare_output_buffer =
|
||||
gst_line_21_decoder_prepare_output_buffer;
|
||||
|
||||
|
@ -202,7 +204,10 @@ gst_line_21_decoder_set_info (GstVideoFilter * filter,
|
|||
self->info = gst_video_info_copy (in_info);
|
||||
|
||||
/* initialize the decoder */
|
||||
vbi_raw_decoder_init (&self->zvbi_decoder);
|
||||
if (self->zvbi_decoder.pattern != NULL)
|
||||
vbi_raw_decoder_reset (&self->zvbi_decoder);
|
||||
else
|
||||
vbi_raw_decoder_init (&self->zvbi_decoder);
|
||||
/*
|
||||
* Set up blank / black / white levels fit for NTSC, no actual relation
|
||||
* with the height of the video
|
||||
|
@ -415,6 +420,16 @@ gst_line_21_decoder_transform_ip (GstVideoFilter * filter,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_line_21_decoder_stop (GstBaseTransform * btrans)
|
||||
{
|
||||
GstLine21Decoder *self = (GstLine21Decoder *) btrans;
|
||||
|
||||
vbi_raw_decoder_destroy (&self->zvbi_decoder);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_line_21_decoder_finalize (GObject * object)
|
||||
{
|
||||
|
|
|
@ -83,6 +83,7 @@ GST_START_TEST (basic)
|
|||
fail_unless (out_cc_meta->data[i] == full_data[i]);
|
||||
|
||||
gst_buffer_unref (outbuf);
|
||||
gst_harness_teardown (h);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue