Loading services/audioflinger/AudioFlinger.cpp +15 −19 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ #include <system/audio_effects/effect_ns.h> #include <system/audio_effects/effect_aec.h> #include <audio_utils/FdToString.h> #include <audio_utils/primitives.h> #include <json/json.h> Loading Loading @@ -2300,15 +2299,7 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output) if (playbackThread != NULL) { ALOGV("closeOutput() %d", output); { // Dump thread before deleting for history audio_utils::FdToString fdToString; const int fd = fdToString.fd(); if (fd >= 0) { playbackThread->dump(fd, {} /* args */); mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose()); } } dumpToThreadLog_l(playbackThread); if (playbackThread->type() == ThreadBase::MIXER) { for (size_t i = 0; i < mPlaybackThreads.size(); i++) { Loading Loading @@ -2341,6 +2332,7 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output) if (mmapThread == 0) { return BAD_VALUE; } dumpToThreadLog_l(mmapThread); mMmapThreads.removeItem(output); ALOGD("closing mmapThread %p", mmapThread.get()); } Loading Loading @@ -2549,15 +2541,7 @@ status_t AudioFlinger::closeInput_nonvirtual(audio_io_handle_t input) if (recordThread != 0) { ALOGV("closeInput() %d", input); { // Dump thread before deleting for history audio_utils::FdToString fdToString; const int fd = fdToString.fd(); if (fd >= 0) { recordThread->dump(fd, {} /* args */); mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose()); } } dumpToThreadLog_l(recordThread); // If we still have effect chains, it means that a client still holds a handle // on at least one effect. We must either move the chain to an existing thread with the Loading Loading @@ -2601,6 +2585,7 @@ status_t AudioFlinger::closeInput_nonvirtual(audio_io_handle_t input) if (mmapThread == 0) { return BAD_VALUE; } dumpToThreadLog_l(mmapThread); mMmapThreads.removeItem(input); } const sp<AudioIoDescriptor> ioDesc = new AudioIoDescriptor(); Loading Loading @@ -2799,6 +2784,17 @@ void AudioFlinger::purgeStaleEffects_l() { return; } // dumpToThreadLog_l() must be called with AudioFlinger::mLock held void AudioFlinger::dumpToThreadLog_l(const sp<ThreadBase> &thread) { audio_utils::FdToString fdToString; const int fd = fdToString.fd(); if (fd >= 0) { thread->dump(fd, {} /* args */); mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose()); } } // checkThread_l() must be called with AudioFlinger::mLock held AudioFlinger::ThreadBase *AudioFlinger::checkThread_l(audio_io_handle_t ioHandle) const { Loading services/audioflinger/AudioFlinger.h +5 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ #include <media/VolumeShaper.h> #include <audio_utils/clock.h> #include <audio_utils/FdToString.h> #include <audio_utils/SimpleLog.h> #include <audio_utils/TimestampVerifier.h> Loading Loading @@ -426,7 +427,10 @@ private: void dumpClients(int fd, const Vector<String16>& args); void dumpInternals(int fd, const Vector<String16>& args); SimpleLog mThreadLog{10}; // 10 Thread history limit SimpleLog mThreadLog{16}; // 16 Thread history limit class ThreadBase; void dumpToThreadLog_l(const sp<ThreadBase> &thread); // --- Client --- class Client : public RefBase { Loading services/audioflinger/Threads.h +5 −3 Original line number Diff line number Diff line Loading @@ -397,6 +397,8 @@ public: bool isMsdDevice() const { return mIsMsdDevice; } virtual void dump(int fd, const Vector<String16>& args) = 0; mutable Mutex mLock; protected: Loading Loading @@ -665,7 +667,7 @@ public: audio_io_handle_t id, audio_devices_t device, type_t type, bool systemReady); virtual ~PlaybackThread(); void dump(int fd, const Vector<String16>& args); void dump(int fd, const Vector<String16>& args) override; // returns a string of audio performance related data in JSON format. virtual Json::Value getJsonDump() const; Loading Loading @@ -1480,7 +1482,7 @@ public: // return true if the caller should then do it's part of the stopping process bool stop(RecordTrack* recordTrack); void dump(int fd, const Vector<String16>& args); void dump(int fd, const Vector<String16>& args) override; AudioStreamIn* clearInput(); virtual sp<StreamHalInterface> stream() const; Loading Loading @@ -1689,7 +1691,7 @@ class MmapThread : public ThreadBase // Sets the UID records silence virtual void setRecordSilenced(uid_t uid __unused, bool silenced __unused) {} void dump(int fd, const Vector<String16>& args); void dump(int fd, const Vector<String16>& args) override; virtual void dumpInternals(int fd, const Vector<String16>& args); void dumpTracks(int fd, const Vector<String16>& args); Loading Loading
services/audioflinger/AudioFlinger.cpp +15 −19 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ #include <system/audio_effects/effect_ns.h> #include <system/audio_effects/effect_aec.h> #include <audio_utils/FdToString.h> #include <audio_utils/primitives.h> #include <json/json.h> Loading Loading @@ -2300,15 +2299,7 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output) if (playbackThread != NULL) { ALOGV("closeOutput() %d", output); { // Dump thread before deleting for history audio_utils::FdToString fdToString; const int fd = fdToString.fd(); if (fd >= 0) { playbackThread->dump(fd, {} /* args */); mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose()); } } dumpToThreadLog_l(playbackThread); if (playbackThread->type() == ThreadBase::MIXER) { for (size_t i = 0; i < mPlaybackThreads.size(); i++) { Loading Loading @@ -2341,6 +2332,7 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output) if (mmapThread == 0) { return BAD_VALUE; } dumpToThreadLog_l(mmapThread); mMmapThreads.removeItem(output); ALOGD("closing mmapThread %p", mmapThread.get()); } Loading Loading @@ -2549,15 +2541,7 @@ status_t AudioFlinger::closeInput_nonvirtual(audio_io_handle_t input) if (recordThread != 0) { ALOGV("closeInput() %d", input); { // Dump thread before deleting for history audio_utils::FdToString fdToString; const int fd = fdToString.fd(); if (fd >= 0) { recordThread->dump(fd, {} /* args */); mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose()); } } dumpToThreadLog_l(recordThread); // If we still have effect chains, it means that a client still holds a handle // on at least one effect. We must either move the chain to an existing thread with the Loading Loading @@ -2601,6 +2585,7 @@ status_t AudioFlinger::closeInput_nonvirtual(audio_io_handle_t input) if (mmapThread == 0) { return BAD_VALUE; } dumpToThreadLog_l(mmapThread); mMmapThreads.removeItem(input); } const sp<AudioIoDescriptor> ioDesc = new AudioIoDescriptor(); Loading Loading @@ -2799,6 +2784,17 @@ void AudioFlinger::purgeStaleEffects_l() { return; } // dumpToThreadLog_l() must be called with AudioFlinger::mLock held void AudioFlinger::dumpToThreadLog_l(const sp<ThreadBase> &thread) { audio_utils::FdToString fdToString; const int fd = fdToString.fd(); if (fd >= 0) { thread->dump(fd, {} /* args */); mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose()); } } // checkThread_l() must be called with AudioFlinger::mLock held AudioFlinger::ThreadBase *AudioFlinger::checkThread_l(audio_io_handle_t ioHandle) const { Loading
services/audioflinger/AudioFlinger.h +5 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ #include <media/VolumeShaper.h> #include <audio_utils/clock.h> #include <audio_utils/FdToString.h> #include <audio_utils/SimpleLog.h> #include <audio_utils/TimestampVerifier.h> Loading Loading @@ -426,7 +427,10 @@ private: void dumpClients(int fd, const Vector<String16>& args); void dumpInternals(int fd, const Vector<String16>& args); SimpleLog mThreadLog{10}; // 10 Thread history limit SimpleLog mThreadLog{16}; // 16 Thread history limit class ThreadBase; void dumpToThreadLog_l(const sp<ThreadBase> &thread); // --- Client --- class Client : public RefBase { Loading
services/audioflinger/Threads.h +5 −3 Original line number Diff line number Diff line Loading @@ -397,6 +397,8 @@ public: bool isMsdDevice() const { return mIsMsdDevice; } virtual void dump(int fd, const Vector<String16>& args) = 0; mutable Mutex mLock; protected: Loading Loading @@ -665,7 +667,7 @@ public: audio_io_handle_t id, audio_devices_t device, type_t type, bool systemReady); virtual ~PlaybackThread(); void dump(int fd, const Vector<String16>& args); void dump(int fd, const Vector<String16>& args) override; // returns a string of audio performance related data in JSON format. virtual Json::Value getJsonDump() const; Loading Loading @@ -1480,7 +1482,7 @@ public: // return true if the caller should then do it's part of the stopping process bool stop(RecordTrack* recordTrack); void dump(int fd, const Vector<String16>& args); void dump(int fd, const Vector<String16>& args) override; AudioStreamIn* clearInput(); virtual sp<StreamHalInterface> stream() const; Loading Loading @@ -1689,7 +1691,7 @@ class MmapThread : public ThreadBase // Sets the UID records silence virtual void setRecordSilenced(uid_t uid __unused, bool silenced __unused) {} void dump(int fd, const Vector<String16>& args); void dump(int fd, const Vector<String16>& args) override; virtual void dumpInternals(int fd, const Vector<String16>& args); void dumpTracks(int fd, const Vector<String16>& args); Loading