From 481fb67a595f23c5b7f5be84b06db9b84a41a42f Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Mon, 30 Sep 2013 14:39:28 -0700 Subject: Add RecordThread media.log and deferred deallocation This change allows a media.log buffer for RecordThread. Unlike playback threads which stick around forever, the RecordThread comes and goes for every capture session. This means that the media.log buffer for a RecordThread would disappear too, and so was useless. Now when a thread exits, it's associated media.log buffer is just marked for deferred deallocation. It is only actually freed when the memory is needed. Other changes: - Fix bug in unregistering comparison, it was comparing the wrong pointers - Increased size of log area so we can log for RecordThread also Change-Id: If45d4c03a793b86390a0112ec3acc5d41b2e3635 --- services/audioflinger/AudioFlinger.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'services/audioflinger/AudioFlinger.h') diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 9137040..066d5d5 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -235,8 +235,12 @@ public: sp newWriter_l(size_t size, const char *name); void unregisterWriter(const sp& writer); private: - static const size_t kLogMemorySize = 10 * 1024; + static const size_t kLogMemorySize = 40 * 1024; sp mLogMemoryDealer; // == 0 when NBLog is disabled + // When a log writer is unregistered, it is done lazily so that media.log can continue to see it + // for as long as possible. The memory is only freed when it is needed for another log writer. + Vector< sp > mUnregisteredWriters; + Mutex mUnregisteredWritersLock; public: class SyncEvent; -- cgit v1.1