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

Commit 668de518 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "AAudio AudioStreamLegacy: refine handling of AudioTrack teardown" into...

Merge "AAudio AudioStreamLegacy: refine handling of AudioTrack teardown" into rvc-dev am: 01d9c845 am: 04ebec3d

Change-Id: I81ce0c8abe9f39a71f4238215fb34549764e220b
parents b42d0df9 04ebec3d
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -215,6 +215,9 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
            : (aaudio_session_id_t) mAudioTrack->getSessionId();
    setSessionId(actualSessionId);

    mInitialBufferCapacity = getBufferCapacity();
    mInitialFramesPerBurst = getFramesPerBurst();

    mAudioTrack->addAudioDeviceCallback(mDeviceCallback);

    // Update performance mode based on the actual stream flags.
@@ -265,7 +268,16 @@ void AudioStreamTrack::processCallback(int event, void *info) {

            // Stream got rerouted so we disconnect.
        case AudioTrack::EVENT_NEW_IAUDIOTRACK:
            // request stream disconnect if the restored AudioTrack has properties not matching
            // what was requested initially
            if (mAudioTrack->channelCount() != getSamplesPerFrame()
                    || mAudioTrack->format() != getFormat()
                    || mAudioTrack->getSampleRate() != getSampleRate()
                    || mAudioTrack->getRoutedDeviceId() != getDeviceId()
                    || getBufferCapacity() != mInitialBufferCapacity
                    || getFramesPerBurst() != mInitialFramesPerBurst) {
                processCallbackCommon(AAUDIO_CALLBACK_OPERATION_DISCONNECTED, info);
            }
            break;

        default:
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ private:

    // TODO add 64-bit position reporting to AudioTrack and use it.
    aaudio_wrapping_frames_t         mPositionWhenPausing = 0;

    // initial AudioTrack frame count and notification period
    int32_t mInitialBufferCapacity = 0;
    int32_t mInitialFramesPerBurst = 0;
};

} /* namespace aaudio */