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
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 7d39822..148644e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4404,6 +4404,7 @@
#endif
{
snprintf(mName, kNameLength, "AudioIn_%X", id);
+ mNBLogWriter = audioFlinger->newWriter_l(kLogSize, mName);
readInputParameters();
}
@@ -4411,6 +4412,7 @@
AudioFlinger::RecordThread::~RecordThread()
{
+ mAudioFlinger->unregisterWriter(mNBLogWriter);
delete[] mRsmpInBuffer;
delete mResampler;
delete[] mRsmpOutBuffer;