summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2014-07-27 22:00:40 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2014-08-14 23:33:18 -0300
commit70f9dcb95db647eda4b844936cbb8c446f51b683 (patch)
tree66f326299338a96ca15f1c4a9fd5fcbbcd86244b /src
parentd66efe2c721cb23d13d3f6c316769c20670855d5 (diff)
pulse: Avoid duplicate sinks on module
Diffstat (limited to 'src')
-rw-r--r--src/lib/backends/pulseaudio/pulse.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/backends/pulseaudio/pulse.c b/src/lib/backends/pulseaudio/pulse.c
index d0c5bd3..61fb069 100644
--- a/src/lib/backends/pulseaudio/pulse.c
+++ b/src/lib/backends/pulseaudio/pulse.c
@@ -646,6 +646,7 @@ _subscribe_cb(pa_context *c, pa_subscription_event_type_t t,
646} 646}
647 647
648static Eina_Bool _epulse_connect(void *data); 648static Eina_Bool _epulse_connect(void *data);
649static void _disconnect_cb();
649 650
650static void 651static void
651_epulse_pa_state_cb(pa_context *context, void *data) 652_epulse_pa_state_cb(pa_context *context, void *data)
@@ -714,8 +715,7 @@ _epulse_pa_state_cb(pa_context *context, void *data)
714 715
715 case PA_CONTEXT_FAILED: 716 case PA_CONTEXT_FAILED:
716 WRN("PA_CONTEXT_FAILED"); 717 WRN("PA_CONTEXT_FAILED");
717 if (ctx->disconnect_cb) 718 _disconnect_cb();
718 ctx->disconnect_cb();
719 _epulse_connect(data); 719 _epulse_connect(data);
720 return; 720 return;
721 721
@@ -796,19 +796,28 @@ _init(sink_event_cb sink_cb, sink_input_event_cb input_cb,
796 } 796 }
797 797
798static void 798static void
799_shutdown(void) 799_disconnect_cb()
800{ 800{
801 Source *source; 801 Source *source;
802 Sink *sink; 802 Sink *sink;
803 Sink_Input *input; 803 Sink_Input *input;
804 804
805 pa_context_unref(ctx->context); 805 if (ctx->disconnect_cb)
806 ctx->disconnect_cb();
807
806 EINA_LIST_FREE(ctx->sources, source) 808 EINA_LIST_FREE(ctx->sources, source)
807 _source_del(source); 809 _source_del(source);
808 EINA_LIST_FREE(ctx->sinks, sink) 810 EINA_LIST_FREE(ctx->sinks, sink)
809 _sink_del(sink); 811 _sink_del(sink);
810 EINA_LIST_FREE(ctx->inputs, input) 812 EINA_LIST_FREE(ctx->inputs, input)
811 _sink_input_del(input); 813 _sink_input_del(input);
814}
815
816static void
817_shutdown(void)
818{
819 pa_context_unref(ctx->context);
820 _disconnect_cb();
812 free(ctx); 821 free(ctx);
813 ctx = NULL; 822 ctx = NULL;
814} 823}