Add a tee sink filename suffix to distinguish type
Test: tee sink filenames have a _C (capture), _P (playback), or _T (track) suffix
Change-Id: Ib8ddadb0f3e3ba3ac620e33072bb212d5cde4978
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 42e9c6b..d546ae3 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -520,7 +520,7 @@
#ifdef TEE_SINK
// dump the serially shared record tee sink
if (mRecordTeeSource != 0) {
- dumpTee(fd, mRecordTeeSource);
+ dumpTee(fd, mRecordTeeSource, AUDIO_IO_HANDLE_NONE, 'C');
}
#endif
@@ -3261,7 +3261,7 @@
}
#ifdef TEE_SINK
-void AudioFlinger::dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_handle_t id)
+void AudioFlinger::dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_handle_t id, char suffix)
{
NBAIO_Source *teeSource = source.get();
if (teeSource != NULL) {
@@ -3323,7 +3323,8 @@
struct tm tm;
localtime_r(&tv.tv_sec, &tm);
strftime(teeTime, sizeof(teeTime), "%Y%m%d%H%M%S", &tm);
- snprintf(&teePath[teePathLen], sizeof(teePath) - teePathLen, "%s_%d.wav", teeTime, id);
+ snprintf(&teePath[teePathLen], sizeof(teePath) - teePathLen, "%s_%d_%c.wav", teeTime, id,
+ suffix);
// if 2 dumpsys are done within 1 second, and rotation didn't work, then discard 2nd
int teeFd = open(teePath, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, S_IRUSR | S_IWUSR);
if (teeFd >= 0) {
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index a8e86a0..864c215 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -825,7 +825,7 @@
#ifdef TEE_SINK
// tee sink, if enabled by property, allows dumpsys to write most recent audio to .wav file
- static void dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_handle_t id = 0);
+ static void dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_handle_t id, char suffix);
// whether tee sink is enabled by property
static bool mTeeSinkInputEnabled;
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 2234f73..5cdabbc 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4751,7 +4751,7 @@
#ifdef TEE_SINK
// Write the tee output to a .wav file
- dumpTee(fd, mTeeSource, mId);
+ dumpTee(fd, mTeeSource, mId, 'M');
#endif
}
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 5e07e3b..a80214c 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -234,7 +234,7 @@
AudioFlinger::ThreadBase::TrackBase::~TrackBase()
{
#ifdef TEE_SINK
- dumpTee(-1, mTeeSource, mId);
+ dumpTee(-1, mTeeSource, mId, 'T');
#endif
// delete the proxy before deleting the shared memory it refers to, to avoid dangling reference
mServerProxy.clear();