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

Commit f5d25e6f authored by Eric Laurent's avatar Eric Laurent
Browse files

audiopolicy: fix AudioRecordingConfiguration callback

Suppress first callback sent by startInput() as the input device is not
yet set and it results in a spurious AudioRecordingConfiguration callback
sent by RecordingActivityMonitor with a null audio device.

Also fix a bug in getInputForAttr() where the wrong audio attributes
were stored in the RecordClientDescriptor resulting in a failure to
create the audio patch when DEFAULT audio source is used.

Bug: 129287962
Test: cts-tradefed run cts-dev -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest
Change-Id: Ia67abfa56ea653cf69e68bfabbb3d19a12adc310
parent 76e348fc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -334,6 +334,13 @@ void AudioInputDescriptor::setClientActive(const sp<RecordClientDescriptor>& cli
void AudioInputDescriptor::updateClientRecordingConfiguration(
    int event, const sp<RecordClientDescriptor>& client)
{
    // do not send callback if starting and no device is selected yet to avoid
    // double callbacks from startInput() before and after the device is selected
    if (event ==  RECORD_CONFIG_EVENT_START
            && mPatchHandle == AUDIO_PATCH_HANDLE_NONE) {
        return;
    }

    const audio_config_base_t sessionConfig = client->config();
    const record_client_info_t recordClientInfo{client->uid(), client->session(),
                                                client->source(), client->portId(),
+1 −1
Original line number Diff line number Diff line
@@ -2025,7 +2025,7 @@ exit:
        mSoundTriggerSessions.indexOfKey(session) > 0;
    *portId = AudioPort::getNextUniqueId();

    clientDesc = new RecordClientDescriptor(*portId, uid, session, *attr, *config,
    clientDesc = new RecordClientDescriptor(*portId, uid, session, attributes, *config,
                                            requestedDeviceId, attributes.source, flags,
                                            isSoundTrigger);
    inputDesc = mInputs.valueFor(*input);