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

Commit ffb5d0b9 authored by Oscar Azucena's avatar Oscar Azucena
Browse files

Revert "Added device info playback config for native players"

Revert "Added update device info playback configuration"

Revert "Added update device info playback configuration"

Revert "Added audio playback configuration CTS test"

Revert submission 13138779-device_id_push_work

Reason for revert: Breaking device tests, see b/176043355
Reverted Changes:
I859d33a4a:Added update device info playback configuration
Icbd1d430b:Added audio playback configuration CTS test
I4a8409d95:Added device info playback config for Open SL ES
I365bafc95:Added update device info playback configuration
I802269fea:Added device info playback config for native playe...

Change-Id: If0a308651b64065a472c7a99cbd3f6de14161878
parent 6f183190
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ aaudio_result_t AudioStream::systemStart() {
    aaudio_result_t result = requestStart_l();
    if (result == AAUDIO_OK) {
        // We only call this for logging in "dumpsys audio". So ignore return code.
        (void) mPlayerBase->startWithStatus(getDeviceId());
        (void) mPlayerBase->start();
    }
    return result;
}
@@ -221,7 +221,7 @@ aaudio_result_t AudioStream::systemPause() {
    aaudio_result_t result = requestPause_l();
    if (result == AAUDIO_OK) {
        // We only call this for logging in "dumpsys audio". So ignore return code.
        (void) mPlayerBase->pauseWithStatus();
        (void) mPlayerBase->pause();
    }
    return result;
}
@@ -251,7 +251,7 @@ aaudio_result_t AudioStream::systemStopFromCallback() {
    aaudio_result_t result = safeStop_l();
    if (result == AAUDIO_OK) {
        // We only call this for logging in "dumpsys audio". So ignore return code.
        (void) mPlayerBase->stopWithStatus();
        (void) mPlayerBase->stop();
    }
    return result;
}
@@ -265,7 +265,7 @@ aaudio_result_t AudioStream::systemStopFromApp() {
    aaudio_result_t result = safeStop_l();
    if (result == AAUDIO_OK) {
        // We only call this for logging in "dumpsys audio". So ignore return code.
        (void) mPlayerBase->stopWithStatus();
        (void) mPlayerBase->stop();
    }
    return result;
}
+16 −38
Original line number Diff line number Diff line
@@ -30,8 +30,7 @@ using media::VolumeShaperOperation;
PlayerBase::PlayerBase() : BnPlayer(),
        mPanMultiplierL(1.0f), mPanMultiplierR(1.0f),
        mVolumeMultiplierL(1.0f), mVolumeMultiplierR(1.0f),
        mPIId(PLAYER_PIID_INVALID), mLastReportedEvent(PLAYER_STATE_UNKNOWN),
        mLastReportedDeviceId(AUDIO_PORT_HANDLE_NONE)
        mPIId(PLAYER_PIID_INVALID), mLastReportedEvent(PLAYER_STATE_UNKNOWN)
{
    ALOGD("PlayerBase::PlayerBase()");
    // use checkService() to avoid blocking if audio service is not up yet
@@ -65,26 +64,14 @@ void PlayerBase::baseDestroy() {
}

//------------------------------------------------------------------------------
void PlayerBase::servicePlayerEvent(player_state_t event, audio_port_handle_t deviceId) {
void PlayerBase::servicePlayerEvent(player_state_t event) {
    if (mAudioManager != 0) {
        bool changed = false;
        {
            Mutex::Autolock _l(mDeviceIdLock);
            changed = mLastReportedDeviceId != deviceId;
            mLastReportedDeviceId = deviceId;
        }

        {
        // only report state change
        Mutex::Autolock _l(mPlayerStateLock);
            // PLAYER_UPDATE_DEVICE_ID is not saved as an actual state, instead it is used to update
            // device ID only.
            if ((event != PLAYER_UPDATE_DEVICE_ID) && (event != mLastReportedEvent)) {
        if (event != mLastReportedEvent
                && mPIId != PLAYER_PIID_INVALID) {
            mLastReportedEvent = event;
                changed = true;
            }
        }
        if (changed && (mPIId != PLAYER_PIID_INVALID)) {
            mAudioManager->playerEvent(mPIId, event, deviceId);
            mAudioManager->playerEvent(mPIId, event);
        }
    }
}
@@ -97,18 +84,14 @@ void PlayerBase::serviceReleasePlayer() {
}

//FIXME temporary method while some player state is outside of this class
void PlayerBase::reportEvent(player_state_t event, audio_port_handle_t deviceId) {
    servicePlayerEvent(event, deviceId);
void PlayerBase::reportEvent(player_state_t event) {
    servicePlayerEvent(event);
}

void PlayerBase::baseUpdateDeviceId(audio_port_handle_t deviceId) {
    servicePlayerEvent(PLAYER_UPDATE_DEVICE_ID, deviceId);
}

status_t PlayerBase::startWithStatus(audio_port_handle_t deviceId) {
status_t PlayerBase::startWithStatus() {
    status_t status = playerStart();
    if (status == NO_ERROR) {
        servicePlayerEvent(PLAYER_STATE_STARTED, deviceId);
        servicePlayerEvent(PLAYER_STATE_STARTED);
    } else {
        ALOGW("PlayerBase::start() error %d", status);
    }
@@ -118,18 +101,18 @@ status_t PlayerBase::startWithStatus(audio_port_handle_t deviceId) {
status_t PlayerBase::pauseWithStatus() {
    status_t status = playerPause();
    if (status == NO_ERROR) {
        servicePlayerEvent(PLAYER_STATE_PAUSED, AUDIO_PORT_HANDLE_NONE);
        servicePlayerEvent(PLAYER_STATE_PAUSED);
    } else {
        ALOGW("PlayerBase::pause() error %d", status);
    }
    return status;
}


status_t PlayerBase::stopWithStatus() {
    status_t status = playerStop();

    if (status == NO_ERROR) {
        servicePlayerEvent(PLAYER_STATE_STOPPED, AUDIO_PORT_HANDLE_NONE);
        servicePlayerEvent(PLAYER_STATE_STOPPED);
    } else {
        ALOGW("PlayerBase::stop() error %d", status);
    }
@@ -140,12 +123,7 @@ status_t PlayerBase::stopWithStatus() {
// Implementation of IPlayer
binder::Status PlayerBase::start() {
    ALOGD("PlayerBase::start() from IPlayer");
    audio_port_handle_t deviceId;
    {
        Mutex::Autolock _l(mDeviceIdLock);
        deviceId = mLastReportedDeviceId;
    }
    (void)startWithStatus(deviceId);
    (void)startWithStatus();
    return binder::Status::ok();
}

+0 −18
Original line number Diff line number Diff line
@@ -36,10 +36,6 @@ TrackPlayerBase::~TrackPlayerBase() {
void TrackPlayerBase::init(AudioTrack* pat, player_type_t playerType, audio_usage_t usage) {
    PlayerBase::init(playerType, usage);
    mAudioTrack = pat;
    if (mAudioTrack != 0) {
        mSelfAudioDeviceCallback = new SelfAudioDeviceCallback(*this);
        mAudioTrack->addAudioDeviceCallback(mSelfAudioDeviceCallback);
    }
}

void TrackPlayerBase::destroy() {
@@ -47,23 +43,9 @@ void TrackPlayerBase::destroy() {
    baseDestroy();
}

TrackPlayerBase::SelfAudioDeviceCallback::SelfAudioDeviceCallback(PlayerBase& self) :
    AudioSystem::AudioDeviceCallback(), mSelf(self) {
}

TrackPlayerBase::SelfAudioDeviceCallback::~SelfAudioDeviceCallback() {
}

void TrackPlayerBase::SelfAudioDeviceCallback::onAudioDeviceUpdate(audio_io_handle_t __unused,
                                                                   audio_port_handle_t deviceId) {
    mSelf.baseUpdateDeviceId(deviceId);
}

void TrackPlayerBase::doDestroy() {
    if (mAudioTrack != 0) {
        mAudioTrack->stop();
        mAudioTrack->removeAudioDeviceCallback(mSelfAudioDeviceCallback);
        mSelfAudioDeviceCallback.clear();
        // Note that there may still be another reference in post-unlock phase of SetPlayState
        mAudioTrack.clear();
    }
+3 −8
Original line number Diff line number Diff line
@@ -44,14 +44,12 @@ public:
            const media::VolumeShaperConfiguration& configuration,
            const media::VolumeShaperOperation& operation) override;

            status_t startWithStatus(audio_port_handle_t deviceId);
            status_t startWithStatus();
            status_t pauseWithStatus();
            status_t stopWithStatus();

            //FIXME temporary method while some player state is outside of this class
            void reportEvent(player_state_t event, audio_port_handle_t deviceId);

            void baseUpdateDeviceId(audio_port_handle_t deviceId);
            void reportEvent(player_state_t event);

protected:

@@ -73,7 +71,7 @@ protected:

private:
            // report events to AudioService
            void servicePlayerEvent(player_state_t event, audio_port_handle_t deviceId);
            void servicePlayerEvent(player_state_t event);
            void serviceReleasePlayer();

    // native interface to AudioService
@@ -85,9 +83,6 @@ private:
    // Mutex for state reporting
    Mutex mPlayerStateLock;
    player_state_t mLastReportedEvent;

    Mutex mDeviceIdLock;
    audio_port_handle_t mLastReportedDeviceId;
};

} // namespace android
+0 −12
Original line number Diff line number Diff line
@@ -53,20 +53,8 @@ private:
            void doDestroy();
            status_t doSetVolume();

            class SelfAudioDeviceCallback : public AudioSystem::AudioDeviceCallback {
            public:
                SelfAudioDeviceCallback(PlayerBase& self);
                virtual void onAudioDeviceUpdate(audio_io_handle_t audioIo,
                                                         audio_port_handle_t deviceId);
            private:
                virtual ~SelfAudioDeviceCallback();
                PlayerBase& mSelf;
            };

    // volume coming from the player volume API
    float mPlayerVolumeL, mPlayerVolumeR;

   sp<SelfAudioDeviceCallback> mSelfAudioDeviceCallback;
};

} // namespace android