mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
tests: rtpbin: fix caps leak
https://bugzilla.gnome.org/show_bug.cgi?id=767156
This commit is contained in:
parent
507e99cb96
commit
57eb9fec72
1 changed files with 7 additions and 4 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue