From a9493a39859dcbe437f587fb36c9f8ec1dd0d317 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Fri, 8 Aug 2014 14:08:19 +0200 Subject: [PATCH] opusenc: Unref pad template caps after usage Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734517 --- ext/opus/gstopusenc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ext/opus/gstopusenc.c b/ext/opus/gstopusenc.c index 195d88fecd..f9cf624448 100644 --- a/ext/opus/gstopusenc.c +++ b/ext/opus/gstopusenc.c @@ -717,6 +717,7 @@ gst_opus_enc_sink_getcaps (GstAudioEncoder * benc, GstCaps * filter) { GstOpusEnc *enc; GstCaps *caps; + GstCaps *tcaps; GstCaps *peercaps = NULL; GstCaps *intersect = NULL; guint i; @@ -734,8 +735,9 @@ gst_opus_enc_sink_getcaps (GstAudioEncoder * benc, GstCaps * filter) (GST_AUDIO_ENCODER_SINK_PAD (benc))); } - intersect = gst_caps_intersect (peercaps, - gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SRC_PAD (benc))); + tcaps = gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SRC_PAD (benc)); + intersect = gst_caps_intersect (peercaps, tcaps); + gst_caps_unref (tcaps); gst_caps_unref (peercaps); if (gst_caps_is_empty (intersect)) @@ -756,9 +758,8 @@ gst_opus_enc_sink_getcaps (GstAudioEncoder * benc, GstCaps * filter) gst_caps_unref (intersect); - caps = - gst_caps_copy (gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SINK_PAD - (benc))); + caps = gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SINK_PAD (benc)); + caps = gst_caps_make_writable (caps); if (!allow_multistream) { GValue range = { 0 }; g_value_init (&range, GST_TYPE_INT_RANGE);