Loading services/audioflinger/AudioFlinger.h +1 −1 Original line number Diff line number Diff line Loading @@ -604,7 +604,7 @@ private: virtual status_t standby(); private: sp<MmapThread> mThread; const sp<MmapThread> mThread; }; ThreadBase *checkThread_l(audio_io_handle_t ioHandle) const; Loading services/audioflinger/Threads.cpp +3 −24 Original line number Diff line number Diff line Loading @@ -7503,34 +7503,22 @@ void AudioFlinger::RecordThread::getAudioPortConfig(struct audio_port_config *co AudioFlinger::MmapThreadHandle::MmapThreadHandle(const sp<MmapThread>& thread) : mThread(thread) { assert(thread != 0); // thread must start non-null and stay non-null } AudioFlinger::MmapThreadHandle::~MmapThreadHandle() { MmapThread *thread = mThread.get(); // clear our strong reference before disconnecting the thread: the last strong reference // will be removed when closeInput/closeOutput is executed upon call from audio policy manager // and the thread removed from mMMapThreads list causing the thread destruction. mThread.clear(); if (thread != nullptr) { thread->disconnect(); } mThread->disconnect(); } status_t AudioFlinger::MmapThreadHandle::createMmapBuffer(int32_t minSizeFrames, struct audio_mmap_buffer_info *info) { if (mThread == 0) { return NO_INIT; } return mThread->createMmapBuffer(minSizeFrames, info); } status_t AudioFlinger::MmapThreadHandle::getMmapPosition(struct audio_mmap_position *position) { if (mThread == 0) { return NO_INIT; } return mThread->getMmapPosition(position); } Loading @@ -7538,25 +7526,16 @@ status_t AudioFlinger::MmapThreadHandle::start(const AudioClient& client, audio_port_handle_t *handle) { if (mThread == 0) { return NO_INIT; } return mThread->start(client, handle); } status_t AudioFlinger::MmapThreadHandle::stop(audio_port_handle_t handle) { if (mThread == 0) { return NO_INIT; } return mThread->stop(handle); } status_t AudioFlinger::MmapThreadHandle::standby() { if (mThread == 0) { return NO_INIT; } return mThread->standby(); } Loading Loading @@ -7588,7 +7567,7 @@ void AudioFlinger::MmapThread::disconnect() for (const sp<MmapTrack> &t : mActiveTracks) { stop(t->portId()); } // this will cause the destruction of this thread. // This will decrement references and may cause the destruction of this thread. if (isOutput()) { AudioSystem::releaseOutput(mId, streamType(), mSessionId); } else { Loading Loading
services/audioflinger/AudioFlinger.h +1 −1 Original line number Diff line number Diff line Loading @@ -604,7 +604,7 @@ private: virtual status_t standby(); private: sp<MmapThread> mThread; const sp<MmapThread> mThread; }; ThreadBase *checkThread_l(audio_io_handle_t ioHandle) const; Loading
services/audioflinger/Threads.cpp +3 −24 Original line number Diff line number Diff line Loading @@ -7503,34 +7503,22 @@ void AudioFlinger::RecordThread::getAudioPortConfig(struct audio_port_config *co AudioFlinger::MmapThreadHandle::MmapThreadHandle(const sp<MmapThread>& thread) : mThread(thread) { assert(thread != 0); // thread must start non-null and stay non-null } AudioFlinger::MmapThreadHandle::~MmapThreadHandle() { MmapThread *thread = mThread.get(); // clear our strong reference before disconnecting the thread: the last strong reference // will be removed when closeInput/closeOutput is executed upon call from audio policy manager // and the thread removed from mMMapThreads list causing the thread destruction. mThread.clear(); if (thread != nullptr) { thread->disconnect(); } mThread->disconnect(); } status_t AudioFlinger::MmapThreadHandle::createMmapBuffer(int32_t minSizeFrames, struct audio_mmap_buffer_info *info) { if (mThread == 0) { return NO_INIT; } return mThread->createMmapBuffer(minSizeFrames, info); } status_t AudioFlinger::MmapThreadHandle::getMmapPosition(struct audio_mmap_position *position) { if (mThread == 0) { return NO_INIT; } return mThread->getMmapPosition(position); } Loading @@ -7538,25 +7526,16 @@ status_t AudioFlinger::MmapThreadHandle::start(const AudioClient& client, audio_port_handle_t *handle) { if (mThread == 0) { return NO_INIT; } return mThread->start(client, handle); } status_t AudioFlinger::MmapThreadHandle::stop(audio_port_handle_t handle) { if (mThread == 0) { return NO_INIT; } return mThread->stop(handle); } status_t AudioFlinger::MmapThreadHandle::standby() { if (mThread == 0) { return NO_INIT; } return mThread->standby(); } Loading Loading @@ -7588,7 +7567,7 @@ void AudioFlinger::MmapThread::disconnect() for (const sp<MmapTrack> &t : mActiveTracks) { stop(t->portId()); } // this will cause the destruction of this thread. // This will decrement references and may cause the destruction of this thread. if (isOutput()) { AudioSystem::releaseOutput(mId, streamType(), mSessionId); } else { Loading