audio: Add voice call wideband support

Change-Id: Idf6725aaaf906109ce973a8109b7c252a997dead
tirimbino
Andreas Schneider 8 years ago
parent 82f3248400
commit 59486fa48c
  1. 41
      audio/audio_hw.c
  2. 6
      audio/audio_hw.h
  3. 5
      audio/voice.c
  4. 1
      audio/voice.h

@ -310,8 +310,11 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_HEADPHONES] = "headphones",
[SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = "speaker-and-headphones",
[SND_DEVICE_OUT_VOICE_EARPIECE] = "voice-earpiece",
[SND_DEVICE_OUT_VOICE_EARPIECE_WB] = "voice-earpiece-wb",
[SND_DEVICE_OUT_VOICE_SPEAKER] = "voice-speaker",
[SND_DEVICE_OUT_VOICE_SPEAKER_WB] = "voice-speaker-wb",
[SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones",
[SND_DEVICE_OUT_VOICE_HEADPHONES_WB] = "voice-headphones-wb",
[SND_DEVICE_OUT_HDMI] = "hdmi",
[SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi",
[SND_DEVICE_OUT_BT_SCO] = "bt-sco-headset",
@ -325,8 +328,11 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_HEADSET_MIC_AEC] = "headset-mic",
[SND_DEVICE_IN_VOICE_MIC] = "voice-mic",
[SND_DEVICE_IN_VOICE_EARPIECE_MIC] = "voice-earpiece-mic",
[SND_DEVICE_IN_VOICE_EARPIECE_MIC_WB] = "voice-earpiece-mic-wb",
[SND_DEVICE_IN_VOICE_SPEAKER_MIC] = "voice-speaker-mic",
[SND_DEVICE_IN_VOICE_SPEAKER_MIC_WB] = "voice-speaker-mic-wb",
[SND_DEVICE_IN_VOICE_HEADSET_MIC] = "voice-headset-mic",
[SND_DEVICE_IN_VOICE_HEADSET_MIC_WB] = "voice-headset-mic-wb",
[SND_DEVICE_IN_HDMI_MIC] = "hdmi-mic",
[SND_DEVICE_IN_BT_SCO_MIC] = "bt-sco-mic",
[SND_DEVICE_IN_CAMCORDER_MIC] = "camcorder-mic",
@ -530,13 +536,27 @@ static snd_device_t get_output_snd_device(struct audio_device *adev, audio_devic
if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES;
} else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) {
snd_device = SND_DEVICE_OUT_BT_SCO;
} else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
snd_device = SND_DEVICE_OUT_VOICE_SPEAKER;
} else if (devices & AUDIO_DEVICE_OUT_EARPIECE) {
snd_device = SND_DEVICE_OUT_EARPIECE;
snd_device = SND_DEVICE_OUT_VOICE_EARPIECE;
}
if (voice_session_uses_wideband(adev->voice.session)) {
if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES_WB;
} else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_WB;
} else if (devices & AUDIO_DEVICE_OUT_EARPIECE) {
snd_device = SND_DEVICE_OUT_VOICE_EARPIECE_WB;
}
}
if (devices & AUDIO_DEVICE_OUT_ALL_SCO) {
snd_device = SND_DEVICE_OUT_BT_SCO;
}
if (snd_device != SND_DEVICE_NONE) {
goto exit;
}
@ -626,6 +646,21 @@ static snd_device_t get_input_snd_device(struct audio_device *adev, audio_device
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
}
}
if (voice_session_uses_wideband(adev->voice.session)) {
if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC_WB;
}
if (voice_session_uses_twomic(adev->voice.session)) {
if (out_device & AUDIO_DEVICE_OUT_EARPIECE ||
out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
snd_device = SND_DEVICE_IN_VOICE_EARPIECE_MIC_WB;
} else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC_WB;
}
}
}
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {

@ -68,8 +68,11 @@ enum {
SND_DEVICE_OUT_HEADPHONES,
SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
SND_DEVICE_OUT_VOICE_EARPIECE,
SND_DEVICE_OUT_VOICE_EARPIECE_WB,
SND_DEVICE_OUT_VOICE_SPEAKER,
SND_DEVICE_OUT_VOICE_SPEAKER_WB,
SND_DEVICE_OUT_VOICE_HEADPHONES,
SND_DEVICE_OUT_VOICE_HEADPHONES_WB,
SND_DEVICE_OUT_HDMI,
SND_DEVICE_OUT_SPEAKER_AND_HDMI,
SND_DEVICE_OUT_BT_SCO,
@ -89,8 +92,11 @@ enum {
SND_DEVICE_IN_HEADSET_MIC_AEC,
SND_DEVICE_IN_VOICE_MIC,
SND_DEVICE_IN_VOICE_EARPIECE_MIC,
SND_DEVICE_IN_VOICE_EARPIECE_MIC_WB,
SND_DEVICE_IN_VOICE_SPEAKER_MIC,
SND_DEVICE_IN_VOICE_SPEAKER_MIC_WB,
SND_DEVICE_IN_VOICE_HEADSET_MIC,
SND_DEVICE_IN_VOICE_HEADSET_MIC_WB,
SND_DEVICE_IN_HDMI_MIC,
SND_DEVICE_IN_BT_SCO_MIC,
SND_DEVICE_IN_CAMCORDER_MIC,

@ -253,6 +253,11 @@ bool voice_session_uses_twomic(struct voice_session *session)
return session->two_mic_control;
}
bool voice_session_uses_wideband(struct voice_session *session)
{
return session->wb_amr;
}
static void voice_session_wb_amr_callback(void *data, int enable)
{
struct audio_device *adev = (struct audio_device *)data;

@ -41,6 +41,7 @@ void set_voice_session_volume(struct voice_session *session, float volume);
void set_voice_session_audio_path(struct voice_session *session);
bool voice_session_uses_twomic(struct voice_session *session);
bool voice_session_uses_wideband(struct voice_session *session);
struct voice_session *voice_session_init(struct audio_device *adev);
void voice_session_deinit(struct voice_session *s);

Loading…
Cancel
Save