Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PIPIPIG233666/b3e51b79089700e7bef9431c6b893d4f to your computer and use it in GitHub Desktop.
Save PIPIPIG233666/b3e51b79089700e7bef9431c6b893d4f to your computer and use it in GitHub Desktop.
stock platform_set_echo_reference
int __fastcall platform_set_echo_reference(int a1, int a2, int a3)
{
int v3; // r5
int v4; // r7
int v5; // r8
int v6; // r4
int v7; // r4
int v8; // t1
int v9; // r0
int v10; // r6
int v11; // r0
int v12; // r0
bool v13; // zf
const char *v14; // r1
int result; // r0
char dest; // [sp+8h] [bp-88h]
int v17; // [sp+6Ch] [bp-24h]
v3 = a1;
v4 = a2;
v5 = a3;
v6 = *(_DWORD *)(a1 + 544);
j___aeabi_memcpy8_0(&dest, "echo-reference", 0x64u);
j_audio_extn_sound_trigger_update_ec_ref_status(v4);
v8 = *(unsigned __int8 *)(v6 + 232);
v7 = v6 + 232;
if ( v8 )
{
if ( hal_log_mask[30] )
_android_log_print(3, "msm8974_platform", "%s: disabling %s", "platform_set_echo_reference", v7);
audio_route_reset_and_update_path(*(_DWORD *)(v3 + 296), v7);
}
v9 = j_adev_get_active_input(v3);
if ( !v4 )
goto LABEL_22;
v10 = v9;
v11 = j_voice_extn_is_compress_voip_supported();
if ( v10 && !v11 )
{
v12 = *(_DWORD *)(v10 + 160);
v13 = v12 == 7;
if ( v12 != 7 )
v13 = *(_DWORD *)(v3 + 244) == 3;
if ( v13 && *(_DWORD *)(v10 + 176) == 31 )
_strlcat_chk(&dest, "-voip", 100, 100);
}
_strlcpy_chk(v7, &dest, 100, 100);
if ( v5 & 2 )
{
v14 = " speaker";
}
else
{
if ( !(v5 & 0x2000C) )
goto LABEL_23;
v14 = " headphones";
}
while ( 1 )
{
_strlcat_chk(&dest, v14, 100, 100);
if ( audio_route_apply_and_update_path(*(_DWORD *)(v3 + 296), &dest) )
audio_route_apply_and_update_path(*(_DWORD *)(v3 + 296), v7);
else
_strlcpy_chk(v7, &dest, 100, 100);
_android_log_print(3, "msm8974_platform", "%s: enabling %s", "platform_set_echo_reference", v7);
LABEL_22:
result = _stack_chk_guard - v17;
if ( _stack_chk_guard == v17 )
break;
LABEL_23:
if ( v5 & 0x30 )
{
v14 = " bt-sco-headset";
}
else if ( v5 & 0x4000000 )
{
v14 = " usb-headphones";
}
else
{
v14 = " earpiece";
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment