Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 305d0d21 authored by Vignesh Kulothungan's avatar Vignesh Kulothungan Committed by Gerrit - the friendly Code Review server
Browse files

hal: Fix for VoIP call audio mode switch bug

- Audio mode switch between speaker and headset fails during a VoIP call
- This is because only one request is allowed by APM with Direct/VoIP
  flag to get VoIP usecase in HAL.
- If another VoIP request comes in while a VoIP session is still open,
  then the request falls back and is treated as a request for primary
  output with NONE flag.
- And if there are no low-latency sessions open and any previously
  active VoIP session is closed, then the latter VoIP request handles
  routing for primary output.
- The fix allows VoIP usecase to handle routing properly when using
  primary output.

CRs-Fixed: 2000184
Change-Id: Ibda10fe0de64f33ad34340dd0ff3b710918c4461
parent f9ed8f2c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Not a contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -284,9 +284,14 @@ static int voip_stop_call(struct audio_device *adev)
            uc_info = node_to_item(node, struct audio_usecase, list);
            select_devices(adev, uc_info->id);
        }
    } else
        ALOGV("%s: NO-OP because out_stream_count=%d, in_stream_count=%d",
    } else {
        ALOGV("%s: unexpected because out_stream_count=%d, in_stream_count=%d",
               __func__, voip_data.out_stream_count, voip_data.in_stream_count);
        uc_info = get_usecase_from_list(adev, USECASE_COMPRESS_VOIP_CALL);
        if (uc_info)
            uc_info->stream.out = adev->primary_output;
        ret = -EINVAL;
    }

    ALOGV("%s: exit: status(%d)", __func__, ret);
    return ret;