summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Tracks.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2018-04-19 20:04:56 -0700
committerAndy Hung <hunga@google.com>2018-05-21 11:37:46 -0700
commit8946a28aaaadf426ee22b098b4aec7be4d9edc00 (patch)
tree85a9520841616e8c1188d51fd44591543148e874 /services/audioflinger/Tracks.cpp
parentacb7d9ddc1955682379ea514082511b9ea44482e (diff)
downloadframeworks_av-8946a28aaaadf426ee22b098b4aec7be4d9edc00.tar.gz
frameworks_av-8946a28aaaadf426ee22b098b4aec7be4d9edc00.tar.bz2
frameworks_av-8946a28aaaadf426ee22b098b4aec7be4d9edc00.zip
AudioFlinger: Fix Tee logging
1) Fix bad WAV files for tee sources that aren't 16 bit PCM. 2) Allow multiple RecordThread tees instead of one. 3) Allow dump from non-fast MixerThreads (e.g. deep buffer). 4) Parallelize tee dumping for improved concurrency; dump outside of AF lock. 5) Async dumping to allow dump to be issued in time critical code. 6) Improve file naming to distinguish record vs playback tracks, threads, and dump reason. 7) Allow Tee insertion anywhere in code with global running Tee management. 8) Increase resolution of filename time to msec avoid file overwrite. 9) Dump track data upon removal from active tracks to improve timeliness of dumped data. 10) Dump tee data on tee destruction. 11) Refactor Tee code out of AudioFlinger.cpp; minimize footprint. AudioFlinger enabling code requires Configuration.h define TEE_SINK; this is disabled, hence avoiding regression risk. Test: Enable tee log, repeatedly call dumpsys, examine files. Bug: 78369241 Change-Id: I7b22cfa7dbbc1601828de931522065a509ab4047
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r--services/audioflinger/Tracks.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index fc8f34b5f0..9fd17c9930 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -210,22 +210,7 @@ AudioFlinger::ThreadBase::TrackBase::TrackBase(
mBufferSize = bufferSize;
#ifdef TEE_SINK
- if (mTeeSinkTrackEnabled) {
- NBAIO_Format pipeFormat = Format_from_SR_C(mSampleRate, mChannelCount, mFormat);
- if (Format_isValid(pipeFormat)) {
- Pipe *pipe = new Pipe(mTeeSinkTrackFrames, pipeFormat);
- size_t numCounterOffers = 0;
- const NBAIO_Format offers[1] = {pipeFormat};
- ssize_t index = pipe->negotiate(offers, 1, NULL, numCounterOffers);
- ALOG_ASSERT(index == 0);
- PipeReader *pipeReader = new PipeReader(*pipe);
- numCounterOffers = 0;
- index = pipeReader->negotiate(offers, 1, NULL, numCounterOffers);
- ALOG_ASSERT(index == 0);
- mTeeSink = pipe;
- mTeeSource = pipeReader;
- }
- }
+ mTee.set(sampleRate, mChannelCount, format, NBAIO_Tee::TEE_FLAG_TRACK);
#endif
}
@@ -244,9 +229,6 @@ status_t AudioFlinger::ThreadBase::TrackBase::initCheck() const
AudioFlinger::ThreadBase::TrackBase::~TrackBase()
{
-#ifdef TEE_SINK
- dumpTee(-1, mTeeSource, mId, 'T');
-#endif
// delete the proxy before deleting the shared memory it refers to, to avoid dangling reference
mServerProxy.clear();
if (mCblk != NULL) {
@@ -274,9 +256,7 @@ AudioFlinger::ThreadBase::TrackBase::~TrackBase()
void AudioFlinger::ThreadBase::TrackBase::releaseBuffer(AudioBufferProvider::Buffer* buffer)
{
#ifdef TEE_SINK
- if (mTeeSink != 0) {
- (void) mTeeSink->write(buffer->raw, buffer->frameCount);
- }
+ mTee.write(buffer->raw, buffer->frameCount);
#endif
ServerProxy::Buffer buf;
@@ -454,6 +434,12 @@ AudioFlinger::PlaybackThread::Track::Track(
thread->mFastTrackAvailMask &= ~(1 << i);
}
mName = TRACK_NAME_PENDING;
+
+#ifdef TEE_SINK
+ mTee.setId(std::string("_") + std::to_string(mThreadIoHandle)
+ + "_" + std::to_string(mId) +
+ + "_PEND_T");
+#endif
}
AudioFlinger::PlaybackThread::Track::~Track()
@@ -1695,6 +1681,11 @@ AudioFlinger::RecordThread::RecordTrack::RecordTrack(
ALOG_ASSERT(thread->mFastTrackAvail);
thread->mFastTrackAvail = false;
}
+#ifdef TEE_SINK
+ mTee.setId(std::string("_") + std::to_string(mThreadIoHandle)
+ + "_" + std::to_string(mId)
+ + "_R");
+#endif
}
AudioFlinger::RecordThread::RecordTrack::~RecordTrack()