visual: fix caps leak

Fix leak of caps event and of caps objects when setting caps on sink and src
pads. Sync audiovisualizer class implementation to the one in gst-plugins-bad.
This commit matches c5ef1bee73 in that module.

https://bugzilla.gnome.org/show_bug.cgi?id=742875
This commit is contained in:
Luis de Bethencourt 2015-01-21 15:22:15 +00:00
parent 684e5e0c87
commit 945afe6cc4

View file

@ -768,12 +768,14 @@ gst_audio_visualizer_src_setcaps (GstAudioVisualizer * scope, GstCaps * caps)
/* find a pool for the negotiated caps now */ /* find a pool for the negotiated caps now */
res = gst_audio_visualizer_do_bufferpool (scope, caps); res = gst_audio_visualizer_do_bufferpool (scope, caps);
gst_caps_unref (caps);
return res; return res;
/* ERRORS */ /* ERRORS */
wrong_caps: wrong_caps:
{ {
gst_caps_unref (caps);
GST_DEBUG_OBJECT (scope, "error parsing caps"); GST_DEBUG_OBJECT (scope, "error parsing caps");
return FALSE; return FALSE;
} }
@ -1292,6 +1294,7 @@ gst_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
gst_event_parse_caps (event, &caps); gst_event_parse_caps (event, &caps);
res = gst_audio_visualizer_sink_setcaps (scope, caps); res = gst_audio_visualizer_sink_setcaps (scope, caps);
gst_event_unref (event);
break; break;
} }
case GST_EVENT_FLUSH_STOP: case GST_EVENT_FLUSH_STOP: