diff options
author | Michal Ratajsky <[email protected]> | 2014-11-20 04:28:29 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2014-11-20 04:28:29 +0100 |
commit | 14ae6e0d97fc73fbc516442ed37862523189596b (patch) | |
tree | 9bb8ebcb27385f41a2b2c8d77e7d0f4a0e8678e4 /backends/pulse/pulse-backend.c | |
parent | 6edbe3e6c6cd8d817c68d581b67eb12dfdab9937 (diff) | |
download | libmatemixer-14ae6e0d97fc73fbc516442ed37862523189596b.tar.bz2 libmatemixer-14ae6e0d97fc73fbc516442ed37862523189596b.tar.xz |
pulse: Correctly remove sink inputs/source outputs
Diffstat (limited to 'backends/pulse/pulse-backend.c')
-rw-r--r-- | backends/pulse/pulse-backend.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c index c781cdf..fc14c8d 100644 --- a/backends/pulse/pulse-backend.c +++ b/backends/pulse/pulse-backend.c @@ -198,6 +198,13 @@ static void check_pending_sink (PulseBackend static void check_pending_source (PulseBackend *pulse, PulseStream *stream); +static void remove_sink_input (PulseBackend *backend, + PulseSink *sink, + guint index); +static void remove_source_output (PulseBackend *backend, + PulseSource *source, + guint index); + static void free_list_devices (PulseBackend *pulse); static void free_list_streams (PulseBackend *pulse); static void free_list_ext_streams (PulseBackend *pulse); @@ -899,9 +906,9 @@ on_connection_sink_input_info (PulseConnection *connection, mate_mixer_stream_get_name (MATE_MIXER_STREAM (prev)), info->sink); - pulse_sink_remove_input (prev, info->index); + remove_sink_input (pulse, prev, info->index); } else - g_debug ("Sink input %u created on an unknown sink %u", + g_debug ("Sink input %u created on an unknown sink %u, ignoring", info->index, info->sink); return; @@ -914,7 +921,7 @@ on_connection_sink_input_info (PulseConnection *connection, mate_mixer_stream_get_name (MATE_MIXER_STREAM (prev)), mate_mixer_stream_get_name (MATE_MIXER_STREAM (sink))); - pulse_sink_remove_input (prev, info->index); + remove_sink_input (pulse, prev, info->index); } if (pulse_sink_add_input (sink, info) == TRUE) @@ -934,9 +941,7 @@ on_connection_sink_input_removed (PulseConnection *connection, if G_UNLIKELY (sink == NULL) return; - pulse_sink_remove_input (sink, idx); - - g_hash_table_remove (pulse->priv->sink_input_map, GUINT_TO_POINTER (idx)); + remove_sink_input (pulse, sink, idx); } static void @@ -1042,9 +1047,9 @@ on_connection_source_output_info (PulseConnection *connection, mate_mixer_stream_get_name (MATE_MIXER_STREAM (prev)), info->source); - pulse_source_remove_output (prev, info->index); + remove_source_output (pulse, prev, info->index); } else - g_debug ("Source output %u created on an unknown source %u", + g_debug ("Source output %u created on an unknown source %u, ignoring", info->index, info->source); return; @@ -1057,7 +1062,7 @@ on_connection_source_output_info (PulseConnection *connection, mate_mixer_stream_get_name (MATE_MIXER_STREAM (prev)), mate_mixer_stream_get_name (MATE_MIXER_STREAM (source))); - pulse_source_remove_output (prev, info->index); + remove_source_output (pulse, prev, info->index); } if (pulse_source_add_output (source, info) == TRUE) @@ -1077,9 +1082,7 @@ on_connection_source_output_removed (PulseConnection *connection, if G_UNLIKELY (source == NULL) return; - pulse_source_remove_output (source, idx); - - g_hash_table_remove (pulse->priv->source_output_map, GUINT_TO_POINTER (idx)); + remove_source_output (pulse, source, idx); } static void @@ -1214,6 +1217,22 @@ check_pending_source (PulseBackend *pulse, PulseStream *stream) } static void +remove_sink_input (PulseBackend *pulse, PulseSink *sink, guint index) +{ + pulse_sink_remove_input (sink, index); + + g_hash_table_remove (pulse->priv->sink_input_map, GUINT_TO_POINTER (index)); +} + +static void +remove_source_output (PulseBackend *pulse, PulseSource *source, guint index) +{ + pulse_source_remove_output (source, index); + + g_hash_table_remove (pulse->priv->source_output_map, GUINT_TO_POINTER (index)); +} + +static void free_list_devices (PulseBackend *pulse) { if (pulse->priv->devices_list == NULL) |