visualizer: dynamically parse the sound card when opening mixer
Sound card number is not always 0 with USB headset, get it dynamically when opening mixer. CRs-Fixed: 2620185 Change-Id: I019e5988bc845af1f721ef00fbe874137c1811ef
This commit is contained in:
parent
7098e119a7
commit
df4dc4ac23
|
@ -192,11 +192,6 @@ int thread_status;
|
||||||
|
|
||||||
#define DSP_OUTPUT_LATENCY_MS 0 /* Fudge factor for latency after capture point in audio DSP */
|
#define DSP_OUTPUT_LATENCY_MS 0 /* Fudge factor for latency after capture point in audio DSP */
|
||||||
|
|
||||||
/* Retry for delay for mixer open */
|
|
||||||
#define RETRY_NUMBER 10
|
|
||||||
#define RETRY_US 500000
|
|
||||||
|
|
||||||
#define MIXER_CARD 0
|
|
||||||
#define SOUND_CARD 0
|
#define SOUND_CARD 0
|
||||||
|
|
||||||
#ifndef CAPTURE_DEVICE
|
#ifndef CAPTURE_DEVICE
|
||||||
|
@ -471,12 +466,12 @@ void *capture_thread_loop(void *arg)
|
||||||
|
|
||||||
pthread_mutex_lock(&lock);
|
pthread_mutex_lock(&lock);
|
||||||
|
|
||||||
mixer = mixer_open(MIXER_CARD);
|
sound_card =
|
||||||
while (mixer == NULL && retry_num < RETRY_NUMBER) {
|
parse_pcm_device("AFE-PROXY TX", SND_CARD_NUM);
|
||||||
usleep(RETRY_US);
|
sound_card =
|
||||||
mixer = mixer_open(MIXER_CARD);
|
(sound_card == -1)? SOUND_CARD : sound_card;
|
||||||
retry_num++;
|
|
||||||
}
|
mixer = mixer_open(sound_card);
|
||||||
if (mixer == NULL) {
|
if (mixer == NULL) {
|
||||||
pthread_mutex_unlock(&lock);
|
pthread_mutex_unlock(&lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -490,10 +485,6 @@ void *capture_thread_loop(void *arg)
|
||||||
if (!capture_enabled) {
|
if (!capture_enabled) {
|
||||||
ret = configure_proxy_capture(mixer, 1);
|
ret = configure_proxy_capture(mixer, 1);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
sound_card =
|
|
||||||
parse_pcm_device("AFE-PROXY TX", SND_CARD_NUM);
|
|
||||||
sound_card =
|
|
||||||
(sound_card == -1)? SOUND_CARD : sound_card;
|
|
||||||
capture_device =
|
capture_device =
|
||||||
parse_pcm_device("AFE-PROXY TX", DEVICE_ID);
|
parse_pcm_device("AFE-PROXY TX", DEVICE_ID);
|
||||||
capture_device =
|
capture_device =
|
||||||
|
|
Loading…
Reference in New Issue