From: Guillaume Desmottes Date: Thu, 2 Jun 2016 13:03:17 +0000 (+0200) Subject: tests: rtpbin: fix caps leak X-Git-Tag: 1.10.4~369 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57eb9fec72160cd913bb62d1e2e47bb26b07aa6f;p=platform%2Fupstream%2Fgst-plugins-good.git tests: rtpbin: fix caps leak https://bugzilla.gnome.org/show_bug.cgi?id=767156 --- diff --git a/tests/check/elements/rtpbin.c b/tests/check/elements/rtpbin.c index 372faed..67bbfdd 100644 --- a/tests/check/elements/rtpbin.c +++ b/tests/check/elements/rtpbin.c @@ -111,6 +111,7 @@ typedef struct GCond cond; GstPad *sinkpad; GList *pads; + GstCaps *caps; } CleanupData; static void @@ -121,6 +122,7 @@ init_data (CleanupData * data) g_mutex_init (&data->lock); g_cond_init (&data->cond); data->pads = NULL; + data->caps = NULL; } static void @@ -130,6 +132,8 @@ clean_data (CleanupData * data) g_list_free (data->pads); g_mutex_clear (&data->lock); g_cond_clear (&data->cond); + if (data->caps) + gst_caps_unref (data->caps); } static guint8 rtp_packet[] = { 0x80, 0x60, 0x94, 0xbc, 0x8f, 0x37, 0x4e, 0xb8, @@ -142,20 +146,19 @@ static GstFlowReturn chain_rtp_packet (GstPad * pad, CleanupData * data) { GstFlowReturn res; - static GstCaps *caps = NULL; GstSegment segment; GstBuffer *buffer; GstMapInfo map; - if (caps == NULL) { - caps = gst_caps_from_string ("application/x-rtp," + if (data->caps == NULL) { + data->caps = gst_caps_from_string ("application/x-rtp," "media=(string)audio, clock-rate=(int)44100, " "encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1"); data->seqnum = 0; } gst_pad_send_event (pad, gst_event_new_stream_start (GST_OBJECT_NAME (pad))); - gst_pad_send_event (pad, gst_event_new_caps (caps)); + gst_pad_send_event (pad, gst_event_new_caps (data->caps)); gst_segment_init (&segment, GST_FORMAT_TIME); gst_pad_send_event (pad, gst_event_new_segment (&segment));