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

Commit ee7aaa52 authored by Andy Hung's avatar Andy Hung Committed by Automerger Merge Worker
Browse files

Merge "SoundPool: Fix verbose logging compilation" into rvc-dev am: 73606857

Original change: undetermined

Change-Id: Ia6dbb8dbf71292f31ebb95446379ab905a541db5
parents cf89cad3 73606857
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -107,7 +107,8 @@ void SoundDecoder::loadSound(int32_t soundID)
    }
    // Launch threads as needed.  The "as needed" is weakly consistent as we release mLock.
    if (pendingSounds > mThreadPool->getActiveThreadCount()) {
        const int32_t id __unused = mThreadPool->launch([this](int32_t id) { run(id); });
        const int32_t id = mThreadPool->launch([this](int32_t id) { run(id); });
        (void)id; // avoid clang warning -Wunused-variable -Wused-but-marked-unused
        ALOGV_IF(id != 0, "%s: launched thread %d", __func__, id);
    }
}
+6 −4
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ void Stream::stop()
void Stream::stop_l()
{
    if (mState != IDLE) {
        ALOGV("%s: track streamID: %d", __func__, (int)mStreamID);
        ALOGV("%s: track(%p) streamID: %d", __func__, mAudioTrack.get(), (int)mStreamID);
        if (mAudioTrack != nullptr) {
            mAudioTrack->stop();
        }
@@ -232,7 +232,7 @@ Stream* Stream::playPairStream() {
    LOG_ALWAYS_FATAL_IF(pairStream == nullptr, "No pair stream!");
    sp<AudioTrack> releaseTracks[2];
    {
        ALOGV("%s: track streamID: %d", __func__, (int)mStreamID);
        ALOGV("%s: track streamID: %d", __func__, (int)getStreamID());
        // TODO: Do we really want to force a simultaneous synchronization between
        // the stream and its pair?

@@ -390,10 +390,10 @@ void Stream::staticCallback(int event, void* user, void* info)

void Stream::callback(int event, void* info, int toggle, int tries)
{
    ALOGV("%s streamID %d", __func__, (int)mStreamID);
    int32_t activeStreamIDToRestart = 0;
    {
        std::unique_lock lock(mLock);
        ALOGV("%s track(%p) streamID %d", __func__, mAudioTrack.get(), (int)mStreamID);

        if (mAudioTrack == nullptr) {
            // The AudioTrack is either with this stream or its pair.
@@ -403,6 +403,7 @@ void Stream::callback(int event, void* info, int toggle, int tries)
            // logic here.
            if (tries < 3) {
                lock.unlock();
                ALOGV("%s streamID %d going to pair stream", __func__, (int)mStreamID);
                getPairStream()->callback(event, info, toggle, tries + 1);
            } else {
                ALOGW("%s streamID %d cannot find track", __func__, (int)mStreamID);
@@ -449,8 +450,9 @@ void Stream::callback(int event, void* info, int toggle, int tries)

void Stream::dump() const
{
    // TODO: consider std::try_lock() - ok for now for ALOGV.
    ALOGV("mPairStream=%p, mState=%d, mStreamID=%d, mSoundID=%d, mPriority=%d, mLoop=%d",
            getPairStream(), mState, (int)mStreamID, mSoundID, mPriority, mLoop);
            getPairStream(), mState, (int)getStreamID(), getSoundID(), mPriority, mLoop);
}

} // namespace android::soundpool
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public:
    void resume(int32_t streamID);
    void autoResume();
    void mute(bool muting);
    void dump() const;
    void dump() const NO_THREAD_SAFETY_ANALYSIS; // disable for ALOGV (see func for details).

    // returns the pair stream if successful, nullptr otherwise
    Stream* playPairStream();
+4 −2
Original line number Diff line number Diff line
@@ -249,7 +249,8 @@ int32_t StreamManager::queueForPlay(const std::shared_ptr<Sound> &sound,
    } // lock

    if (launchThread) {
        const int32_t id __unused = mThreadPool->launch([this](int32_t id) { run(id); });
        const int32_t id = mThreadPool->launch([this](int32_t id) { run(id); });
        (void)id; // avoid clang warning -Wunused-variable -Wused-but-marked-unused
        ALOGV_IF(id != 0, "%s: launched thread %d", __func__, id);
    }
    ALOGV("%s: returning %d", __func__, streamID);
@@ -277,7 +278,8 @@ void StreamManager::moveToRestartQueue(
        sanityCheckQueue_l();
    }
    if (restart) {
        const int32_t id __unused = mThreadPool->launch([this](int32_t id) { run(id); });
        const int32_t id = mThreadPool->launch([this](int32_t id) { run(id); });
        (void)id; // avoid clang warning -Wunused-variable -Wused-but-marked-unused
        ALOGV_IF(id != 0, "%s: launched thread %d", __func__, id);
    }
}