Loading services/audioflinger/Threads.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,12 @@ static const int kPriorityFastMixer = 3; // See the client's minBufCount and mNotificationFramesAct calculations for details. static const int kFastTrackMultiplier = 2; // See Thread::readOnlyHeap(). // Initially this heap is used to allocate client buffers for "fast" AudioRecord. // Eventually it will be the single buffer that FastCapture writes into via HAL read(), // and that all "fast" AudioRecord clients read from. In either case, the size can be small. static const size_t kRecordThreadReadOnlyHeapSize = 0x1000; // ---------------------------------------------------------------------------- #ifdef ADD_BATTERY_DATA Loading Loading @@ -4635,6 +4641,8 @@ AudioFlinger::RecordThread::RecordThread(const sp<AudioFlinger>& audioFlinger, #ifdef TEE_SINK , mTeeSink(teeSink) #endif , mReadOnlyHeap(new MemoryDealer(kRecordThreadReadOnlyHeapSize, "RecordThreadRO", MemoryHeapBase::READ_ONLY)) { snprintf(mName, kNameLength, "AudioIn_%X", id); mNBLogWriter = audioFlinger->newWriter_l(kLogSize, mName); Loading services/audioflinger/Threads.h +11 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,13 @@ public: virtual status_t setSyncEvent(const sp<SyncEvent>& event) = 0; virtual bool isValidSyncEvent(const sp<SyncEvent>& event) const = 0; // Return a reference to a per-thread heap which can be used to allocate IMemory // objects that will be read-only to client processes, read/write to mediaserver, // and shared by all client processes of the thread. // The heap is per-thread rather than common across all threads, because // clients can't be trusted not to modify the offset of the IMemory they receive. // If a thread does not have such a heap, this method returns 0. virtual sp<MemoryDealer> readOnlyHeap() const { return 0; } mutable Mutex mLock; Loading Loading @@ -947,6 +954,8 @@ public: virtual status_t initCheck() const { return (mInput == NULL) ? NO_INIT : NO_ERROR; } virtual sp<MemoryDealer> readOnlyHeap() const { return mReadOnlyHeap; } sp<AudioFlinger::RecordThread::RecordTrack> createRecordTrack_l( const sp<AudioFlinger::Client>& client, uint32_t sampleRate, Loading Loading @@ -1021,4 +1030,6 @@ private: // For dumpsys const sp<NBAIO_Sink> mTeeSink; const sp<MemoryDealer> mReadOnlyHeap; }; Loading
services/audioflinger/Threads.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,12 @@ static const int kPriorityFastMixer = 3; // See the client's minBufCount and mNotificationFramesAct calculations for details. static const int kFastTrackMultiplier = 2; // See Thread::readOnlyHeap(). // Initially this heap is used to allocate client buffers for "fast" AudioRecord. // Eventually it will be the single buffer that FastCapture writes into via HAL read(), // and that all "fast" AudioRecord clients read from. In either case, the size can be small. static const size_t kRecordThreadReadOnlyHeapSize = 0x1000; // ---------------------------------------------------------------------------- #ifdef ADD_BATTERY_DATA Loading Loading @@ -4635,6 +4641,8 @@ AudioFlinger::RecordThread::RecordThread(const sp<AudioFlinger>& audioFlinger, #ifdef TEE_SINK , mTeeSink(teeSink) #endif , mReadOnlyHeap(new MemoryDealer(kRecordThreadReadOnlyHeapSize, "RecordThreadRO", MemoryHeapBase::READ_ONLY)) { snprintf(mName, kNameLength, "AudioIn_%X", id); mNBLogWriter = audioFlinger->newWriter_l(kLogSize, mName); Loading
services/audioflinger/Threads.h +11 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,13 @@ public: virtual status_t setSyncEvent(const sp<SyncEvent>& event) = 0; virtual bool isValidSyncEvent(const sp<SyncEvent>& event) const = 0; // Return a reference to a per-thread heap which can be used to allocate IMemory // objects that will be read-only to client processes, read/write to mediaserver, // and shared by all client processes of the thread. // The heap is per-thread rather than common across all threads, because // clients can't be trusted not to modify the offset of the IMemory they receive. // If a thread does not have such a heap, this method returns 0. virtual sp<MemoryDealer> readOnlyHeap() const { return 0; } mutable Mutex mLock; Loading Loading @@ -947,6 +954,8 @@ public: virtual status_t initCheck() const { return (mInput == NULL) ? NO_INIT : NO_ERROR; } virtual sp<MemoryDealer> readOnlyHeap() const { return mReadOnlyHeap; } sp<AudioFlinger::RecordThread::RecordTrack> createRecordTrack_l( const sp<AudioFlinger::Client>& client, uint32_t sampleRate, Loading Loading @@ -1021,4 +1030,6 @@ private: // For dumpsys const sp<NBAIO_Sink> mTeeSink; const sp<MemoryDealer> mReadOnlyHeap; };