Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libaudio: Commit

hardware/libaudio


Commit MetaInfo

Revision2bd5215c57c0f6ccba8af36d050618f52153e3b3 (tree)
Time2016-08-05 18:22:44
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

audio_route: avoid an unnecessary error

The change tries to remove the error message:

07-27 16:25:15.129 1249 1249 E audio_hw_primary: Unable to open the mixer, aborting.

However, audio_route still doesn't work properly unless
we put an appropriate mixer_paths.xml.

Change Summary

Incremental Difference

--- a/audio_route.c
+++ b/audio_route.c
@@ -26,13 +26,14 @@
2626
2727 #include <cutils/log.h>
2828
29+#include <sound/asound.h>
2930 #include <tinyalsa/asoundlib.h>
3031
3132 #define BUF_SIZE 1024
3233 #define MIXER_XML_PATH "/system/etc/mixer_paths.xml"
3334 #define INITIAL_MIXER_PATH_SIZE 8
3435
35-#define MIXER_CARD 1
36+struct snd_pcm_info *select_card(unsigned int device __unused, unsigned int flags);
3637
3738 struct mixer_state {
3839 struct mixer_ctl *ctl;
@@ -456,7 +457,12 @@ struct audio_route *audio_route_init(void)
456457 if (!ar)
457458 goto err_calloc;
458459
459- ar->mixer = mixer_open(MIXER_CARD);
460+ struct snd_pcm_info *info = select_card(0, PCM_OUT);
461+ if (!info) {
462+ ALOGW("Unable to find the mixer");
463+ goto err_mixer_open;
464+ }
465+ ar->mixer = mixer_open(info->card);
460466 if (!ar->mixer) {
461467 ALOGE("Unable to open the mixer, aborting.");
462468 goto err_mixer_open;
Show on old repository browser