Loading media/libaudioclient/AudioTrack.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -1857,6 +1857,8 @@ status_t AudioTrack::createTrack_l() .set(AMEDIAMETRICS_PROP_FLAGS, toString(mFlags).c_str()) .set(AMEDIAMETRICS_PROP_ORIGINALFLAGS, toString(mOrigFlags).c_str()) .set(AMEDIAMETRICS_PROP_SESSIONID, (int32_t)mSessionId) .set(AMEDIAMETRICS_PROP_LOGSESSIONID, mLogSessionId) .set(AMEDIAMETRICS_PROP_PLAYERIID, mPlayerIId) .set(AMEDIAMETRICS_PROP_TRACKID, mPortId) // dup from key .set(AMEDIAMETRICS_PROP_CONTENTTYPE, toString(mAttributes.content_type).c_str()) .set(AMEDIAMETRICS_PROP_USAGE, toString(mAttributes.usage).c_str()) Loading Loading @@ -3263,6 +3265,30 @@ uint32_t AudioTrack::getUnderrunFrames() const return mProxy->getUnderrunFrames(); } void AudioTrack::setLogSessionId(const char *logSessionId) { AutoMutex lock(mLock); if (mLogSessionId == logSessionId) return; mLogSessionId = logSessionId; mediametrics::LogItem(mMetricsId) .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_SETLOGSESSIONID) .set(AMEDIAMETRICS_PROP_LOGSESSIONID, logSessionId) .record(); } void AudioTrack::setPlayerIId(int playerIId) { AutoMutex lock(mLock); if (mPlayerIId == playerIId) return; mPlayerIId = playerIId; mediametrics::LogItem(mMetricsId) .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_SETPLAYERIID) .set(AMEDIAMETRICS_PROP_PLAYERIID, playerIId) .record(); } status_t AudioTrack::addAudioDeviceCallback(const sp<AudioSystem::AudioDeviceCallback>& callback) { Loading media/libaudioclient/include/media/AudioTrack.h +28 −0 Original line number Diff line number Diff line Loading @@ -986,6 +986,22 @@ public: */ audio_port_handle_t getPortId() const { return mPortId; }; /* Sets the LogSessionId field which is used for metrics association of * this object with other objects. */ void setLogSessionId(const char *logSessionId); /* Sets the playerIId field to associate the AudioTrack with an interface managed by * AudioService. * * If this value is not set, then the playerIId is reported as -1 * (not associated with an AudioService player interface). * * For metrics purposes, we keep the playerIId association in the native * client AudioTrack to improve the robustness under track restoration. */ void setPlayerIId(int playerIId); void setAudioTrackCallback(const sp<media::IAudioTrackCallback>& callback) { mAudioTrackCallback->setAudioTrackCallback(callback); } Loading Loading @@ -1255,6 +1271,18 @@ public: int mAuxEffectId; audio_port_handle_t mPortId; // Id from Audio Policy Manager /** * mPlayerIId is the player id of the AudioTrack used by AudioManager. * For an AudioTrack created by the Java interface, this is generally set once. */ int mPlayerIId = -1; // AudioManager.h PLAYER_PIID_INVALID /** * mLogSessionId is a string identifying this AudioTrack for the metrics service. * It may be unique or shared with other objects. */ std::string mLogSessionId{}; mutable Mutex mLock; int mPreviousPriority; // before start() Loading media/libmediametrics/include/MediaMetricsConstants.h +4 −0 Original line number Diff line number Diff line Loading @@ -125,12 +125,14 @@ #define AMEDIAMETRICS_PROP_INPUTDEVICES "inputDevices" // string value #define AMEDIAMETRICS_PROP_INTERVALCOUNT "intervalCount" // int32 #define AMEDIAMETRICS_PROP_LATENCYMS "latencyMs" // double value #define AMEDIAMETRICS_PROP_LOGSESSIONID "logSessionId" // hex string, "" none #define AMEDIAMETRICS_PROP_NAME "name" // string value #define AMEDIAMETRICS_PROP_ORIGINALFLAGS "originalFlags" // int32 #define AMEDIAMETRICS_PROP_OUTPUTDEVICES "outputDevices" // string value #define AMEDIAMETRICS_PROP_PERFORMANCEMODE "performanceMode" // string value, "none", lowLatency" #define AMEDIAMETRICS_PROP_PLAYBACK_PITCH "playback.pitch" // double value (AudioTrack) #define AMEDIAMETRICS_PROP_PLAYBACK_SPEED "playback.speed" // double value (AudioTrack) #define AMEDIAMETRICS_PROP_PLAYERIID "playerIId" // int32 (-1 invalid/unset IID) #define AMEDIAMETRICS_PROP_ROUTEDDEVICEID "routedDeviceId" // int32 #define AMEDIAMETRICS_PROP_SAMPLERATE "sampleRate" // int32 #define AMEDIAMETRICS_PROP_SELECTEDDEVICEID "selectedDeviceId" // int32 Loading Loading @@ -181,7 +183,9 @@ #define AMEDIAMETRICS_PROP_EVENT_VALUE_RESTORE "restore" #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETMODE "setMode" // AudioFlinger #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETBUFFERSIZE "setBufferSize" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETLOGSESSIONID "setLogSessionId" // AudioTrack, Record #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETPLAYBACKPARAM "setPlaybackParam" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETPLAYERIID "setPlayerIId" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETVOICEVOLUME "setVoiceVolume" // AudioFlinger #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETVOLUME "setVolume" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_START "start" // AudioTrack, AudioRecord Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -2184,7 +2184,9 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr, status = BAD_VALUE; goto error; } if (policyMix) { if (device->type() == AUDIO_DEVICE_IN_ECHO_REFERENCE) { *inputType = API_INPUT_MIX_CAPTURE; } else if (policyMix) { ALOG_ASSERT(policyMix->mMixType == MIX_TYPE_RECORDERS, "Invalid Mix Type"); // there is an external policy, but this input is attached to a mix of recorders, // meaning it receives audio injected into the framework, so the recorder doesn't Loading services/tuner/TunerService.cpp +10 −9 Original line number Diff line number Diff line Loading @@ -49,7 +49,12 @@ using ::android::hardware::tv::tuner::V1_1::FrontendDtmbCapabilities; namespace android { TunerService::TunerService() {} TunerService::TunerService() { ::ndk::SpAIBinder binder(AServiceManager_waitForService("tv_tuner_resource_mgr")); mTunerResourceManager = ITunerResourceManager::fromBinder(binder); updateTunerResources(); } TunerService::~TunerService() {} binder_status_t TunerService::instantiate() { Loading Loading @@ -282,19 +287,15 @@ Status TunerService::openDescrambler(int32_t /*descramblerHandle*/, return Status::ok(); } Status TunerService::updateTunerResources() { if (!hasITuner()) { return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE)); void TunerService::updateTunerResources() { if (!hasITuner() || mTunerResourceManager == NULL) { ALOGE("Failed to updateTunerResources"); return; } // Connect with Tuner Resource Manager. ::ndk::SpAIBinder binder(AServiceManager_getService("tv_tuner_resource_mgr")); mTunerResourceManager = ITunerResourceManager::fromBinder(binder); updateFrontendResources(); updateLnbResources(); // TODO: update Demux, Descrambler. return Status::ok(); } Status TunerService::getTunerHalVersion(int* _aidl_return) { Loading Loading
media/libaudioclient/AudioTrack.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -1857,6 +1857,8 @@ status_t AudioTrack::createTrack_l() .set(AMEDIAMETRICS_PROP_FLAGS, toString(mFlags).c_str()) .set(AMEDIAMETRICS_PROP_ORIGINALFLAGS, toString(mOrigFlags).c_str()) .set(AMEDIAMETRICS_PROP_SESSIONID, (int32_t)mSessionId) .set(AMEDIAMETRICS_PROP_LOGSESSIONID, mLogSessionId) .set(AMEDIAMETRICS_PROP_PLAYERIID, mPlayerIId) .set(AMEDIAMETRICS_PROP_TRACKID, mPortId) // dup from key .set(AMEDIAMETRICS_PROP_CONTENTTYPE, toString(mAttributes.content_type).c_str()) .set(AMEDIAMETRICS_PROP_USAGE, toString(mAttributes.usage).c_str()) Loading Loading @@ -3263,6 +3265,30 @@ uint32_t AudioTrack::getUnderrunFrames() const return mProxy->getUnderrunFrames(); } void AudioTrack::setLogSessionId(const char *logSessionId) { AutoMutex lock(mLock); if (mLogSessionId == logSessionId) return; mLogSessionId = logSessionId; mediametrics::LogItem(mMetricsId) .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_SETLOGSESSIONID) .set(AMEDIAMETRICS_PROP_LOGSESSIONID, logSessionId) .record(); } void AudioTrack::setPlayerIId(int playerIId) { AutoMutex lock(mLock); if (mPlayerIId == playerIId) return; mPlayerIId = playerIId; mediametrics::LogItem(mMetricsId) .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_SETPLAYERIID) .set(AMEDIAMETRICS_PROP_PLAYERIID, playerIId) .record(); } status_t AudioTrack::addAudioDeviceCallback(const sp<AudioSystem::AudioDeviceCallback>& callback) { Loading
media/libaudioclient/include/media/AudioTrack.h +28 −0 Original line number Diff line number Diff line Loading @@ -986,6 +986,22 @@ public: */ audio_port_handle_t getPortId() const { return mPortId; }; /* Sets the LogSessionId field which is used for metrics association of * this object with other objects. */ void setLogSessionId(const char *logSessionId); /* Sets the playerIId field to associate the AudioTrack with an interface managed by * AudioService. * * If this value is not set, then the playerIId is reported as -1 * (not associated with an AudioService player interface). * * For metrics purposes, we keep the playerIId association in the native * client AudioTrack to improve the robustness under track restoration. */ void setPlayerIId(int playerIId); void setAudioTrackCallback(const sp<media::IAudioTrackCallback>& callback) { mAudioTrackCallback->setAudioTrackCallback(callback); } Loading Loading @@ -1255,6 +1271,18 @@ public: int mAuxEffectId; audio_port_handle_t mPortId; // Id from Audio Policy Manager /** * mPlayerIId is the player id of the AudioTrack used by AudioManager. * For an AudioTrack created by the Java interface, this is generally set once. */ int mPlayerIId = -1; // AudioManager.h PLAYER_PIID_INVALID /** * mLogSessionId is a string identifying this AudioTrack for the metrics service. * It may be unique or shared with other objects. */ std::string mLogSessionId{}; mutable Mutex mLock; int mPreviousPriority; // before start() Loading
media/libmediametrics/include/MediaMetricsConstants.h +4 −0 Original line number Diff line number Diff line Loading @@ -125,12 +125,14 @@ #define AMEDIAMETRICS_PROP_INPUTDEVICES "inputDevices" // string value #define AMEDIAMETRICS_PROP_INTERVALCOUNT "intervalCount" // int32 #define AMEDIAMETRICS_PROP_LATENCYMS "latencyMs" // double value #define AMEDIAMETRICS_PROP_LOGSESSIONID "logSessionId" // hex string, "" none #define AMEDIAMETRICS_PROP_NAME "name" // string value #define AMEDIAMETRICS_PROP_ORIGINALFLAGS "originalFlags" // int32 #define AMEDIAMETRICS_PROP_OUTPUTDEVICES "outputDevices" // string value #define AMEDIAMETRICS_PROP_PERFORMANCEMODE "performanceMode" // string value, "none", lowLatency" #define AMEDIAMETRICS_PROP_PLAYBACK_PITCH "playback.pitch" // double value (AudioTrack) #define AMEDIAMETRICS_PROP_PLAYBACK_SPEED "playback.speed" // double value (AudioTrack) #define AMEDIAMETRICS_PROP_PLAYERIID "playerIId" // int32 (-1 invalid/unset IID) #define AMEDIAMETRICS_PROP_ROUTEDDEVICEID "routedDeviceId" // int32 #define AMEDIAMETRICS_PROP_SAMPLERATE "sampleRate" // int32 #define AMEDIAMETRICS_PROP_SELECTEDDEVICEID "selectedDeviceId" // int32 Loading Loading @@ -181,7 +183,9 @@ #define AMEDIAMETRICS_PROP_EVENT_VALUE_RESTORE "restore" #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETMODE "setMode" // AudioFlinger #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETBUFFERSIZE "setBufferSize" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETLOGSESSIONID "setLogSessionId" // AudioTrack, Record #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETPLAYBACKPARAM "setPlaybackParam" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETPLAYERIID "setPlayerIId" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETVOICEVOLUME "setVoiceVolume" // AudioFlinger #define AMEDIAMETRICS_PROP_EVENT_VALUE_SETVOLUME "setVolume" // AudioTrack #define AMEDIAMETRICS_PROP_EVENT_VALUE_START "start" // AudioTrack, AudioRecord Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -2184,7 +2184,9 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr, status = BAD_VALUE; goto error; } if (policyMix) { if (device->type() == AUDIO_DEVICE_IN_ECHO_REFERENCE) { *inputType = API_INPUT_MIX_CAPTURE; } else if (policyMix) { ALOG_ASSERT(policyMix->mMixType == MIX_TYPE_RECORDERS, "Invalid Mix Type"); // there is an external policy, but this input is attached to a mix of recorders, // meaning it receives audio injected into the framework, so the recorder doesn't Loading
services/tuner/TunerService.cpp +10 −9 Original line number Diff line number Diff line Loading @@ -49,7 +49,12 @@ using ::android::hardware::tv::tuner::V1_1::FrontendDtmbCapabilities; namespace android { TunerService::TunerService() {} TunerService::TunerService() { ::ndk::SpAIBinder binder(AServiceManager_waitForService("tv_tuner_resource_mgr")); mTunerResourceManager = ITunerResourceManager::fromBinder(binder); updateTunerResources(); } TunerService::~TunerService() {} binder_status_t TunerService::instantiate() { Loading Loading @@ -282,19 +287,15 @@ Status TunerService::openDescrambler(int32_t /*descramblerHandle*/, return Status::ok(); } Status TunerService::updateTunerResources() { if (!hasITuner()) { return Status::fromServiceSpecificError(static_cast<int32_t>(Result::UNAVAILABLE)); void TunerService::updateTunerResources() { if (!hasITuner() || mTunerResourceManager == NULL) { ALOGE("Failed to updateTunerResources"); return; } // Connect with Tuner Resource Manager. ::ndk::SpAIBinder binder(AServiceManager_getService("tv_tuner_resource_mgr")); mTunerResourceManager = ITunerResourceManager::fromBinder(binder); updateFrontendResources(); updateLnbResources(); // TODO: update Demux, Descrambler. return Status::ok(); } Status TunerService::getTunerHalVersion(int* _aidl_return) { Loading