summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio_in.c1
-rw-r--r--audio_out.c1
-rw-r--r--mixer.c6
3 files changed, 7 insertions, 1 deletions
diff --git a/audio_in.c b/audio_in.c
index c89947e..a27ab98 100644
--- a/audio_in.c
+++ b/audio_in.c
@@ -411,6 +411,7 @@ int audio_hw_open_input_stream(struct audio_hw_device *dev,
return -ENOMEM;
tinyalsa_audio_stream_in->device = tinyalsa_audio_device;
+ tinyalsa_audio_device->stream_in = tinyalsa_audio_stream_in;
stream = &(tinyalsa_audio_stream_in->stream);
stream->common.get_sample_rate = audio_in_get_sample_rate;
diff --git a/audio_out.c b/audio_out.c
index 969c8f6..573dd4e 100644
--- a/audio_out.c
+++ b/audio_out.c
@@ -432,6 +432,7 @@ int audio_hw_open_output_stream(struct audio_hw_device *dev,
return -ENOMEM;
tinyalsa_audio_stream_out->device = tinyalsa_audio_device;
+ tinyalsa_audio_device->stream_out = tinyalsa_audio_stream_out;
stream = &(tinyalsa_audio_stream_out->stream);
stream->common.get_sample_rate = audio_out_get_sample_rate;
diff --git a/mixer.c b/mixer.c
index e18d1da..d0685e8 100644
--- a/mixer.c
+++ b/mixer.c
@@ -752,6 +752,10 @@ int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer,
goto error_mixer;
}
+ // No need to disable and enable the same route
+ if(mixer_device == mixer_io->device_current)
+ goto exit_mixer;
+
if(mixer_io->device_current != NULL) {
rc = tinyalsa_mixer_set_route_list(mixer, mixer_io->device_current->disable);
if(rc < 0) {
@@ -768,6 +772,7 @@ int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer,
mixer_io->device_current = mixer_device;
+exit_mixer:
mixer_close(mixer->mixer);
mixer->mixer = NULL;
@@ -1028,7 +1033,6 @@ int tinyalsa_mixer_set_state(struct tinyalsa_mixer *mixer,
mixer_io->device_current = NULL;
mixer_io->state = state;
-exit_mixer:
mixer_close(mixer->mixer);
mixer->mixer = NULL;