diff options
author | Ricardo Salveti de Araujo <ricardo.salveti@canonical.com> | 2014-09-04 18:57:14 -0300 |
---|---|---|
committer | Ricardo Salveti de Araujo <ricardo.salveti@canonical.com> | 2014-09-04 18:57:14 -0300 |
commit | a471ebcd8243a1b44609047203a323a117b84704 (patch) | |
tree | a192da40a16714fdf7f0b1a044e6c9e52f48da05 /src | |
parent | cd8738feb5198fe64924af6869fdc977bca747d9 (diff) | |
download | ayatana-indicator-datetime-a471ebcd8243a1b44609047203a323a117b84704.tar.gz ayatana-indicator-datetime-a471ebcd8243a1b44609047203a323a117b84704.tar.bz2 ayatana-indicator-datetime-a471ebcd8243a1b44609047203a323a117b84704.zip |
sound: check for audio_sink and also unref after using the object
Diffstat (limited to 'src')
-rw-r--r-- | src/sound.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sound.cpp b/src/sound.cpp index 0b7894a..c6a7b0a 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -114,15 +114,19 @@ private: { /* Set the media role if audio sink is pulsesink */ GstElement *audio_sink = NULL; - GstPluginFeature *feature = NULL; g_object_get(self->m_play, "audio-sink", &audio_sink, NULL); - feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory); - if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0) + if (audio_sink) { - std::string role_str("props,media.role=alarm"); - GstStructure *props = gst_structure_from_string(role_str.c_str(), NULL); - g_object_set(audio_sink, "stream-properties", props, NULL); - gst_structure_free(props); + GstPluginFeature *feature = NULL; + feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory); + if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0) + { + std::string role_str("props,media.role=alarm"); + GstStructure *props = gst_structure_from_string(role_str.c_str(), NULL); + g_object_set(audio_sink, "stream-properties", props, NULL); + gst_structure_free(props); + } + gst_object_unref(audio_sink); } } |