diff options
author | Daniel Willmann <d.willmann@samsung.com> | 2013-04-19 16:41:17 +0100 |
---|---|---|
committer | Daniel Willmann <d.willmann@samsung.com> | 2013-04-19 18:34:16 +0100 |
commit | 6781342d3c992d27ca928ab03d833c6d5f508ac8 (patch) | |
tree | 17da04774ea68dfddd5f6744e248792f58a79048 /src/lib/ecore_audio | |
parent | f12b3b94d0830b04eb1c38c6b1b7c58f5b547e55 (diff) |
ecore_audio: Guard against attaching an input twice
Add check in input_attach and change test case accordingly
Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r-- | src/lib/ecore_audio/ecore_audio_obj_out.c | 6 | ||||
-rw-r--r-- | src/lib/ecore_audio/ecore_audio_obj_out_pulse.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out.c b/src/lib/ecore_audio/ecore_audio_obj_out.c index 1e7b2d2473..253cf62ad6 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_out.c +++ b/src/lib/ecore_audio/ecore_audio_obj_out.c | |||
@@ -29,6 +29,12 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list) | |||
29 | 29 | ||
30 | in = eo_data_get(input, ECORE_AUDIO_OBJ_IN_CLASS); | 30 | in = eo_data_get(input, ECORE_AUDIO_OBJ_IN_CLASS); |
31 | 31 | ||
32 | if (ret) | ||
33 | *ret = EINA_FALSE; | ||
34 | |||
35 | if (in->output == eo_obj) | ||
36 | return; | ||
37 | |||
32 | if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input)); | 38 | if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input)); |
33 | in->output = eo_obj; | 39 | in->output = eo_obj; |
34 | 40 | ||
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c index 4402694303..0232a10e41 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c +++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c | |||
@@ -116,6 +116,10 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in) | |||
116 | Eina_Bool ret; | 116 | Eina_Bool ret; |
117 | Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); | 117 | Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); |
118 | 118 | ||
119 | eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret)); | ||
120 | if (!ret) | ||
121 | return EINA_FALSE; | ||
122 | |||
119 | ss.format = PA_SAMPLE_FLOAT32LE; | 123 | ss.format = PA_SAMPLE_FLOAT32LE; |
120 | eo_do(in, ecore_audio_obj_in_samplerate_get((int *)&ss.rate)); | 124 | eo_do(in, ecore_audio_obj_in_samplerate_get((int *)&ss.rate)); |
121 | eo_do(in, ecore_audio_obj_in_speed_get(&speed)); | 125 | eo_do(in, ecore_audio_obj_in_speed_get(&speed)); |
@@ -127,11 +131,10 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in) | |||
127 | stream = pa_stream_new(class_vars.context, name, &ss, NULL); | 131 | stream = pa_stream_new(class_vars.context, name, &ss, NULL); |
128 | if (!stream) { | 132 | if (!stream) { |
129 | ERR("Could not create stream"); | 133 | ERR("Could not create stream"); |
134 | eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in)); | ||
130 | return EINA_FALSE; | 135 | return EINA_FALSE; |
131 | } | 136 | } |
132 | 137 | ||
133 | eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret)); | ||
134 | |||
135 | eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj)); | 138 | eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj)); |
136 | 139 | ||
137 | eo_do(in, eo_base_data_set("pulse_data", stream, NULL)); | 140 | eo_do(in, eo_base_data_set("pulse_data", stream, NULL)); |