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

Commit 1adf20ce authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "fix volume and effect enable delay on offloaded tracks" into klp-dev

parents f006989d 59fe010b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ public:

    /* Return NO_ERROR if timestamp is valid */
    virtual status_t    getTimestamp(AudioTimestamp& timestamp) = 0;

    /* Signal the playback thread for a change in control block */
    virtual void        signal() = 0;
};

// ----------------------------------------------------------------------------
+3 −0
Original line number Diff line number Diff line
@@ -534,6 +534,9 @@ status_t AudioTrack::setVolume(float left, float right)

    mProxy->setVolumeLR((uint32_t(uint16_t(right * 0x1000)) << 16) | uint16_t(left * 0x1000));

    if (isOffloaded()) {
        mAudioTrack->signal();
    }
    return NO_ERROR;
}

+12 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ enum {
    SET_MEDIA_TIME_TRANSFORM,
    SET_PARAMETERS,
    GET_TIMESTAMP,
    SIGNAL,
};

class BpAudioTrack : public BpInterface<IAudioTrack>
@@ -182,6 +183,12 @@ public:
        }
        return status;
    }

    virtual void signal() {
        Parcel data, reply;
        data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
        remote()->transact(SIGNAL, data, &reply);
    }
};

IMPLEMENT_META_INTERFACE(AudioTrack, "android.media.IAudioTrack");
@@ -269,6 +276,11 @@ status_t BnAudioTrack::onTransact(
            }
            return NO_ERROR;
        } break;
        case SIGNAL: {
            CHECK_INTERFACE(IAudioTrack, data, reply);
            signal();
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
+1 −0
Original line number Diff line number Diff line
@@ -412,6 +412,7 @@ private:
                                                  int target);
        virtual status_t    setParameters(const String8& keyValuePairs);
        virtual status_t    getTimestamp(AudioTimestamp& timestamp);
        virtual void        signal(); // signal playback thread for a change in control block

        virtual status_t onTransact(
            uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
+17 −5
Original line number Diff line number Diff line
@@ -972,8 +972,14 @@ status_t AudioFlinger::EffectHandle::enable()
        }
        mEnabled = false;
    } else {
        if (thread != 0 && !mEffect->isOffloadable()) {
            if ((thread->type() == ThreadBase::OFFLOAD)) {
        if (thread != 0) {
            if (thread->type() == ThreadBase::OFFLOAD) {
                PlaybackThread *t = (PlaybackThread *)thread.get();
                Mutex::Autolock _l(t->mLock);
                t->broadcast_l();
            }
            if (!mEffect->isOffloadable()) {
                if (thread->type() == ThreadBase::OFFLOAD) {
                    PlaybackThread *t = (PlaybackThread *)thread.get();
                    t->invalidateTracks(AUDIO_STREAM_MUSIC);
                }
@@ -982,6 +988,7 @@ status_t AudioFlinger::EffectHandle::enable()
                }
            }
        }
    }
    return status;
}

@@ -1009,6 +1016,11 @@ status_t AudioFlinger::EffectHandle::disable()
    sp<ThreadBase> thread = mEffect->thread().promote();
    if (thread != 0) {
        thread->checkSuspendOnEffectEnabled(mEffect, false, mEffect->sessionId());
        if (thread->type() == ThreadBase::OFFLOAD) {
            PlaybackThread *t = (PlaybackThread *)thread.get();
            Mutex::Autolock _l(t->mLock);
            t->broadcast_l();
        }
    }

    return status;
Loading