Loading media/libaaudio/src/client/AudioStreamInternal.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -647,6 +647,8 @@ aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *mes if (getState() == AAUDIO_STREAM_STATE_STARTING) { setState(AAUDIO_STREAM_STATE_STARTED); } mPlayerBase->triggerPortIdUpdate(static_cast<audio_port_handle_t>( message->event.dataLong)); break; case AAUDIO_SERVICE_EVENT_PAUSED: ALOGD("%s - got AAUDIO_SERVICE_EVENT_PAUSED", __func__); Loading media/libaudioclient/PlayerBase.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,20 @@ void PlayerBase::init(player_type_t playerType, audio_usage_t usage, audio_sessi } } void PlayerBase::triggerPortIdUpdate(audio_port_handle_t portId) const { if (mAudioManager == nullptr) { ALOGE("%s: no audio service, player %d will not update portId %d", __func__, mPIId, portId); return; } if (mPIId != PLAYER_PIID_INVALID && portId != AUDIO_PORT_HANDLE_NONE) { mAudioManager->playerEvent(mPIId, android::PLAYER_UPDATE_PORT_ID, portId); } } void PlayerBase::baseDestroy() { serviceReleasePlayer(); if (mAudioManager != 0) { Loading media/libaudioclient/include/media/PlayerBase.h +4 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ public: void baseUpdateDeviceId(audio_port_handle_t deviceId); /** * Updates the mapping in the AudioService between portId and piid */ void triggerPortIdUpdate(audio_port_handle_t portId) const; protected: void init(player_type_t playerType, audio_usage_t usage, audio_session_t sessionId); Loading @@ -74,7 +78,6 @@ protected: // player interface ID, uniquely identifies the player in the system // effectively const after PlayerBase::init(). audio_unique_id_t mPIId; private: // report events to AudioService void servicePlayerEvent(player_state_t event, audio_port_handle_t deviceId); Loading services/audioflinger/MmapTracks.h +15 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,14 @@ public: bool getAndSetSilencedNotified_l() { bool silencedNotified = mSilencedNotified; mSilencedNotified = true; return silencedNotified; } /** * Updates the mute state and notifies the audio service. Call this only when holding player * thread lock. */ void processMuteEvent_l(const sp<IAudioManager>& audioManager, mute_state_t muteState) REQUIRES(AudioFlinger::MmapPlaybackThread::mLock); private: friend class MmapThread; Loading @@ -71,5 +79,12 @@ private: pid_t mPid; bool mSilenced; // protected by MMapThread::mLock bool mSilencedNotified; // protected by MMapThread::mLock // TODO: replace PersistableBundle with own struct // access these two variables only when holding player thread lock. std::unique_ptr<os::PersistableBundle> mMuteEventExtras GUARDED_BY(AudioFlinger::MmapPlaybackThread::mLock); mute_state_t mMuteState GUARDED_BY(AudioFlinger::MmapPlaybackThread::mLock); }; // end of Track services/audioflinger/Threads.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -10465,6 +10465,14 @@ void AudioFlinger::MmapPlaybackThread::processVolume_l() } for (const sp<MmapTrack> &track : mActiveTracks) { track->setMetadataHasChanged(); track->processMuteEvent_l(mAudioFlinger->getOrCreateAudioManager(), /*muteState=*/{mMasterMute, mStreamVolume == 0.f, mStreamMute, // TODO(b/241533526): adjust logic to include mute from AppOps false /*muteFromPlaybackRestricted*/, false /*muteFromClientVolume*/, false /*muteFromVolumeShaper*/}); } } } Loading Loading
media/libaaudio/src/client/AudioStreamInternal.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -647,6 +647,8 @@ aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *mes if (getState() == AAUDIO_STREAM_STATE_STARTING) { setState(AAUDIO_STREAM_STATE_STARTED); } mPlayerBase->triggerPortIdUpdate(static_cast<audio_port_handle_t>( message->event.dataLong)); break; case AAUDIO_SERVICE_EVENT_PAUSED: ALOGD("%s - got AAUDIO_SERVICE_EVENT_PAUSED", __func__); Loading
media/libaudioclient/PlayerBase.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,20 @@ void PlayerBase::init(player_type_t playerType, audio_usage_t usage, audio_sessi } } void PlayerBase::triggerPortIdUpdate(audio_port_handle_t portId) const { if (mAudioManager == nullptr) { ALOGE("%s: no audio service, player %d will not update portId %d", __func__, mPIId, portId); return; } if (mPIId != PLAYER_PIID_INVALID && portId != AUDIO_PORT_HANDLE_NONE) { mAudioManager->playerEvent(mPIId, android::PLAYER_UPDATE_PORT_ID, portId); } } void PlayerBase::baseDestroy() { serviceReleasePlayer(); if (mAudioManager != 0) { Loading
media/libaudioclient/include/media/PlayerBase.h +4 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ public: void baseUpdateDeviceId(audio_port_handle_t deviceId); /** * Updates the mapping in the AudioService between portId and piid */ void triggerPortIdUpdate(audio_port_handle_t portId) const; protected: void init(player_type_t playerType, audio_usage_t usage, audio_session_t sessionId); Loading @@ -74,7 +78,6 @@ protected: // player interface ID, uniquely identifies the player in the system // effectively const after PlayerBase::init(). audio_unique_id_t mPIId; private: // report events to AudioService void servicePlayerEvent(player_state_t event, audio_port_handle_t deviceId); Loading
services/audioflinger/MmapTracks.h +15 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,14 @@ public: bool getAndSetSilencedNotified_l() { bool silencedNotified = mSilencedNotified; mSilencedNotified = true; return silencedNotified; } /** * Updates the mute state and notifies the audio service. Call this only when holding player * thread lock. */ void processMuteEvent_l(const sp<IAudioManager>& audioManager, mute_state_t muteState) REQUIRES(AudioFlinger::MmapPlaybackThread::mLock); private: friend class MmapThread; Loading @@ -71,5 +79,12 @@ private: pid_t mPid; bool mSilenced; // protected by MMapThread::mLock bool mSilencedNotified; // protected by MMapThread::mLock // TODO: replace PersistableBundle with own struct // access these two variables only when holding player thread lock. std::unique_ptr<os::PersistableBundle> mMuteEventExtras GUARDED_BY(AudioFlinger::MmapPlaybackThread::mLock); mute_state_t mMuteState GUARDED_BY(AudioFlinger::MmapPlaybackThread::mLock); }; // end of Track
services/audioflinger/Threads.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -10465,6 +10465,14 @@ void AudioFlinger::MmapPlaybackThread::processVolume_l() } for (const sp<MmapTrack> &track : mActiveTracks) { track->setMetadataHasChanged(); track->processMuteEvent_l(mAudioFlinger->getOrCreateAudioManager(), /*muteState=*/{mMasterMute, mStreamVolume == 0.f, mStreamMute, // TODO(b/241533526): adjust logic to include mute from AppOps false /*muteFromPlaybackRestricted*/, false /*muteFromClientVolume*/, false /*muteFromVolumeShaper*/}); } } } Loading