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

Commit 38f86713 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Audio policy / flinger: updates to recording callback and record stop

Do not trigger the callback for recording events when the patch
  handle is NONE, the patch handle will be updated for the
  recording session later.
When stopping recording, only stop the record thread if the
  track is not active, not if it's not the first one.

Test: cts-tradefed run cts-dev -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest
Bug: 36569938

Change-Id: I1b7445ef4115d6337ba7b926f7e6b068361926a7
parent ef0b6b64
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -6791,7 +6791,7 @@ void AudioFlinger::RecordThread::syncStartEventCallback(const wp<SyncEvent>& eve
bool AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
    ALOGV("RecordThread::stop");
    AutoMutex _l(mLock);
    if (mActiveTracks.indexOf(recordTrack) != 0 || recordTrack->mState == TrackBase::PAUSING) {
    if (mActiveTracks.indexOf(recordTrack) < 0 || recordTrack->mState == TrackBase::PAUSING) {
        return false;
    }
    // note that threadLoop may still be processing the track at this point [without lock]
@@ -6805,7 +6805,7 @@ bool AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
    // FIXME incorrect usage of wait: no explicit predicate or loop
    mStartStopCond.wait(mLock);
    // if we have been restarted, recordTrack is in mActiveTracks here
    if (exitPending() || mActiveTracks.indexOf(recordTrack) != 0) {
    if (exitPending() || mActiveTracks.indexOf(recordTrack) < 0) {
        ALOGV("Record stopped OK");
        return true;
    }
+9 −5
Original line number Diff line number Diff line
@@ -91,9 +91,11 @@ uint32_t AudioSession::changeActiveCount(int delta)
                AUDIO_CONFIG_BASE_INITIALIZER;
        const audio_patch_handle_t patchHandle = (provider != NULL) ? provider->getPatchHandle() :
                AUDIO_PATCH_HANDLE_NONE;
        if (patchHandle != AUDIO_PATCH_HANDLE_NONE) {
            mClientInterface->onRecordingConfigurationUpdate(event, mSession, mInputSource,
                    &mConfig, &deviceConfig, patchHandle);
        }
    }

    return mActiveCount;
}
@@ -126,11 +128,13 @@ void AudioSession::onSessionInfoUpdate() const
                AUDIO_CONFIG_BASE_INITIALIZER;
        const audio_patch_handle_t patchHandle = (provider != NULL) ? provider->getPatchHandle() :
                AUDIO_PATCH_HANDLE_NONE;
        if (patchHandle != AUDIO_PATCH_HANDLE_NONE) {
            mClientInterface->onRecordingConfigurationUpdate(RECORD_CONFIG_EVENT_START,
                    mSession, mInputSource,
                    &mConfig, &deviceConfig, patchHandle);
        }
    }
}

status_t AudioSession::dump(int fd, int spaces, int index) const
{