Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b2191a4 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

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
parent fb91f95f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@ status_t AudioFlinger::dump(int fd, const Vector<String16>& args)
#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 @@ int comparEntry(const void *p1, const void *p2)
}

#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 @@ void AudioFlinger::dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_hand
        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) {
+1 −1
Original line number Diff line number Diff line
@@ -825,7 +825,7 @@ public:

#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;
+1 −1
Original line number Diff line number Diff line
@@ -4751,7 +4751,7 @@ void AudioFlinger::MixerThread::dumpInternals(int fd, const Vector<String16>& ar

#ifdef TEE_SINK
    // Write the tee output to a .wav file
    dumpTee(fd, mTeeSource, mId);
    dumpTee(fd, mTeeSource, mId, 'M');
#endif

}
+1 −1
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ status_t AudioFlinger::ThreadBase::TrackBase::initCheck() const
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();