[Galaxy S 4 General] MemAllocatoR:
bluetooth in call possible fix??

[MENTION=2386505]Alberto96[/MENTION] i think i found something usefull...

i compared audio_hw.c files between yours and between the manta

i9500(your file)

static void start_bt_sco(struct audio_device *adev)
{
struct pcm_config *sco_config;

if (adev->pcm_sco_rx || adev->pcm_sco_tx) {
ALOGW("%s: SCO PCMs already open!\n", __func__);
return;
}

ALOGV("%s: Opening SCO PCMs", __func__);

if (adev->wb_amr)
sco_config = &pcm_config_sco_wide;
else
sco_config = &pcm_config_sco;

adev->pcm_sco_rx = pcm_open(PCM_CARD, PCM_DEVICE_SCO, PCM_OUT,
sco_config);
if (adev->pcm_sco_rx && !pcm_is_ready(adev->pcm_sco_rx)) {
ALOGE("%s: cannot open PCM SCO RX stream: %s",
__func__, pcm_get_error(adev->pcm_sco_rx));
goto err_sco_rx;
}

adev->pcm_sco_tx = pcm_open(PCM_CARD, PCM_DEVICE_SCO, PCM_IN,
sco_config);
if (adev->pcm_sco_tx && !pcm_is_ready(adev->pcm_sco_tx)) {
ALOGE("%s: cannot open PCM SCO TX stream: %s",
__func__, pcm_get_error(adev->pcm_sco_tx));
goto err_sco_tx;
}

[COLOR="Red"]pcm_start(adev->pcm_sco_rx);
pcm_start(adev->pcm_sco_tx);[/COLOR]

return;

manta file:

static void start_bt_sco(struct audio_device *adev) {
if (adev->sco_on_count++ > 0)
return;

adev->pcm_voice_out = pcm_open(PCM_CARD, PCM_DEVICE_VOICE, PCM_OUT | PCM_MONOTONIC,
&pcm_config_sco);
if (adev->pcm_voice_out && !pcm_is_ready(adev->pcm_voice_out)) {
ALOGE("pcm_open(VOICE_OUT) failed: %s", pcm_get_error(adev->pcm_voice_out));
goto err_voice_out;
}
adev->pcm_sco_out = pcm_open(PCM_CARD, PCM_DEVICE_SCO, PCM_OUT | PCM_MONOTONIC,
&pcm_config_sco);
if (adev->pcm_sco_out && !pcm_is_ready(adev->pcm_sco_out)) {
ALOGE("pcm_open(SCO_OUT) failed: %s", pcm_get_error(adev->pcm_sco_out));
goto err_sco_out;
}
adev->pcm_voice_in = pcm_open(PCM_CARD, PCM_DEVICE_VOICE, PCM_IN,
&pcm_config_sco);
if (adev->pcm_voice_in && !pcm_is_ready(adev->pcm_voice_in)) {
ALOGE("pcm_open(VOICE_IN) failed: %s", pcm_get_error(adev->pcm_voice_in));
goto err_voice_in;
}
adev->pcm_sco_in = pcm_open(PCM_CARD, PCM_DEVICE_SCO, PCM_IN,
&pcm_config_sco);
if (adev->pcm_sco_in && !pcm_is_ready(adev->pcm_sco_in)) {
ALOGE("pcm_open(SCO_IN) failed: %s", pcm_get_error(adev->pcm_sco_in));
goto err_sco_in;
}

[COLOR="red"] pcm_start(adev->pcm_voice_out);
pcm_start(adev->pcm_sco_out);
pcm_start(adev->pcm_voice_in);
pcm_start(adev->pcm_sco_in);[/COLOR]
[U][B]in our case:[/B][/U]
[COLOR="Blue"]pcm_start(adev->pcm_voice_rx);
pcm_start(adev->pcm_voice_tx);[/COLOR]

return;

if i understood correctly, the voice_in and voice_out are not starting, meaning that sound is not routed correctly... not so fimiliar yet with all that sound related codes but i hope i helped..sorry if its not usfull, just trying to help.

edit:

also we can add this to help with google now voice recognition issues.. after line 346 in audio_hw.c

// disable noise suppression when capturing front and back mic for voice recognition

if ((adev->input_source == AUDIO_SOURCE_VOICE_RECOGNITION) &&

(adev->in_channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK))

new_es325_preset = -1;

should be this maybe:

/* must be called with the hw device mutex locked, OK to hold other mutexes */
static void start_bt_sco(struct audio_device *adev) {
if (adev->wb_amr)
sco_config = &pcm_config_sco_wide;
else
sco_config = &pcm_config_sco;

adev->pcm_voice_tx = pcm_open(PCM_CARD, PCM_DEVICE_VOICE, PCM_OUT,
&pcm_config_sco);
if (adev->pcm_voice_tx && !pcm_is_ready(adev->pcm_voice_tx)) {
ALOGE("pcm_open(VOICE_OUT) failed: %s", pcm_get_error(adev->pcm_voice_tx));
goto err_voice_tx;
}
adev->pcm_sco_rx = pcm_open(PCM_CARD, PCM_DEVICE_SCO, PCM_OUT,
&pcm_config_sco);
if (adev->pcm_sco_rx && !pcm_is_ready(adev->pcm_sco_rx)) {
ALOGE("pcm_open(SCO_OUT) failed: %s", pcm_get_error(adev->pcm_sco_rx));
goto err_sco_rx;
}
adev->pcm_voice_rx = pcm_open(PCM_CARD, PCM_DEVICE_VOICE, PCM_IN,
&pcm_config_sco);
if (adev->pcm_voice_rx && !pcm_is_ready(adev->pcm_voice_rx)) {
ALOGE("pcm_open(VOICE_IN) failed: %s", pcm_get_error(adev->pcm_voice_rx));
goto err_voice_rx;
}
adev->pcm_sco_rx = pcm_open(PCM_CARD, PCM_DEVICE_SCO, PCM_IN,
&pcm_config_sco);
if (adev->pcm_sco_rx && !pcm_is_ready(adev->pcm_sco_rx)) {
ALOGE("pcm_open(SCO_IN) failed: %s", pcm_get_error(adev->pcm_sco_rx));
goto err_sco_rx;
}

pcm_start(adev->pcm_voice_tx);
pcm_start(adev->pcm_sco_tx);
pcm_start(adev->pcm_voice_rx);
pcm_start(adev->pcm_sco_rx);

return;

err_sco_in:
pcm_close(adev->pcm_sco_rx);
err_voice_in:
pcm_close(adev->pcm_voice_rx);
err_sco_out:
pcm_close(adev->pcm_sco_tx);
err_voice_out:
pcm_close(adev->pcm_voice_tx);
}