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

Commit 283df8ca authored by Tejas Shikhare's avatar Tejas Shikhare Committed by Giulio Cervera
Browse files

frameworks/base: Enable LPA for music stream only.

Enable LPA playback for music streams only. There are no
significant power savings for using LPA with other modes like
ringtone.

CRs-Fixed: 357327

(cherry picked from commit 75484628e5a915422f822b9759cb3ce8f9c4f0ad)

Change-Id: Ibd3940f74bd6b0cf2446e1159640d39a107c2929
parent 524c0d41
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public:
        virtual void        close() = 0;
#ifdef WITH_QCOM_LPA
        virtual void        closeSession() {return;};
        virtual int         getAudioStreamType() {return 0;};
#endif
    };

+6 −0
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ class MediaPlayerService : public BnMediaPlayerService
        virtual void            closeSession();
#endif
                void            setAudioStreamType(int streamType) { mStreamType = streamType; }
#ifdef WITH_QCOM_LPA
        virtual int             getAudioStreamType() { return mStreamType; }
#endif
                void            setVolume(float left, float right);
                status_t        setAuxEffectSendLevel(float level);
                status_t        attachAuxEffect(int effectId);
@@ -162,6 +165,9 @@ class MediaPlayerService : public BnMediaPlayerService
        virtual void            pause() {}
        virtual void            close() {}
                void            setAudioStreamType(int streamType) {}
#ifdef WITH_QCOM_LPA
        virtual int             getAudioStreamType() { return 0; }
#endif
                void            setVolume(float left, float right) {}
                uint32_t        sampleRate() const { return mSampleRate; }
                uint32_t        format() const { return (uint32_t)mFormat; }
+4 −3
Original line number Diff line number Diff line
@@ -936,10 +936,11 @@ status_t AwesomePlayer::play_l() {
                if(strcmp("true",lpaDecode) == 0)
                {
                    LOGV("LPAPlayer::getObjectsAlive() %d",LPAPlayer::objectsAlive);
                    int streamType = mAudioSink->getAudioStreamType();
                    if ( durationUs > 60000000 && !isFormatAdif
                         && (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG) || !strcasecmp(mime,MEDIA_MIMETYPE_AUDIO_AAC))
                         && LPAPlayer::objectsAlive == 0 && mVideoSource == NULL) {
                        LOGE("LPAPlayer created, LPA MODE detected mime %s duration %d\n", mime, durationUs);
                         && LPAPlayer::objectsAlive == 0 && mVideoSource == NULL && streamType == AUDIO_STREAM_MUSIC) {
                        LOGE("LPAPlayer created, LPA MODE detected mime %s duration %lld AudioStream %d", mime, durationUs,streamType);
                        bool initCheck =  false;
                        mAudioPlayer = new LPAPlayer(mAudioSink, initCheck, this);
                        if(!initCheck) {