Loading media/libaudioclient/AudioRecord.cpp +15 −0 Original line number Original line Diff line number Diff line Loading @@ -114,6 +114,7 @@ void AudioRecord::MediaMetrics::gather(const AudioRecord *record) mMetricsItem->setInt32(MM_PREFIX "lastError.code", (int32_t)mLastError); mMetricsItem->setInt32(MM_PREFIX "lastError.code", (int32_t)mLastError); mMetricsItem->setCString(MM_PREFIX "lastError.at", mLastErrorFunc.c_str()); mMetricsItem->setCString(MM_PREFIX "lastError.at", mLastErrorFunc.c_str()); } } mMetricsItem->setCString(MM_PREFIX "logSessionId", record->mLogSessionId.c_str()); } } static const char *stateToString(bool active) { static const char *stateToString(bool active) { Loading Loading @@ -953,6 +954,7 @@ status_t AudioRecord::createRecord_l(const Modulo<uint32_t> &epoch, const String .set(AMEDIAMETRICS_PROP_ORIGINALFLAGS, toString(mOrigFlags).c_str()) .set(AMEDIAMETRICS_PROP_ORIGINALFLAGS, toString(mOrigFlags).c_str()) .set(AMEDIAMETRICS_PROP_SESSIONID, (int32_t)mSessionId) .set(AMEDIAMETRICS_PROP_SESSIONID, (int32_t)mSessionId) .set(AMEDIAMETRICS_PROP_TRACKID, mPortId) .set(AMEDIAMETRICS_PROP_TRACKID, mPortId) .set(AMEDIAMETRICS_PROP_LOGSESSIONID, mLogSessionId) .set(AMEDIAMETRICS_PROP_SOURCE, toString(mAttributes.source).c_str()) .set(AMEDIAMETRICS_PROP_SOURCE, toString(mAttributes.source).c_str()) .set(AMEDIAMETRICS_PROP_THREADID, (int32_t)output.inputId) .set(AMEDIAMETRICS_PROP_THREADID, (int32_t)output.inputId) .set(AMEDIAMETRICS_PROP_SELECTEDDEVICEID, (int32_t)mSelectedDeviceId) .set(AMEDIAMETRICS_PROP_SELECTEDDEVICEID, (int32_t)mSelectedDeviceId) Loading Loading @@ -1574,6 +1576,19 @@ status_t AudioRecord::setPreferredMicrophoneFieldDimension(float zoom) { } } } } void AudioRecord::setLogSessionId(const char *logSessionId) { AutoMutex lock(mLock); if (logSessionId == nullptr) logSessionId = ""; // an empty string is an unset session id. 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 AudioRecord::DeathNotifier::binderDied(const wp<IBinder>& who __unused) void AudioRecord::DeathNotifier::binderDied(const wp<IBinder>& who __unused) Loading media/libaudioclient/AudioTrack.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3269,6 +3269,7 @@ uint32_t AudioTrack::getUnderrunFrames() const void AudioTrack::setLogSessionId(const char *logSessionId) void AudioTrack::setLogSessionId(const char *logSessionId) { { AutoMutex lock(mLock); AutoMutex lock(mLock); if (logSessionId == nullptr) logSessionId = ""; // an empty string is an unset session id. if (mLogSessionId == logSessionId) return; if (mLogSessionId == logSessionId) return; mLogSessionId = logSessionId; mLogSessionId = logSessionId; Loading media/libaudioclient/include/media/AudioRecord.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -578,6 +578,12 @@ public: */ */ audio_port_handle_t getPortId() const { return mPortId; }; audio_port_handle_t getPortId() const { return mPortId; }; /* Sets the LogSessionId field which is used for metrics association of * this object with other objects. A nullptr or empty string clears * the logSessionId. */ void setLogSessionId(const char *logSessionId); /* /* * Dumps the state of an audio record. * Dumps the state of an audio record. */ */ Loading Loading @@ -701,6 +707,14 @@ private: audio_session_t mSessionId; audio_session_t mSessionId; audio_port_handle_t mPortId; // Id from Audio Policy Manager audio_port_handle_t mPortId; // Id from Audio Policy Manager /** * mLogSessionId is a string identifying this AudioRecord for the metrics service. * It may be unique or shared with other objects. An empty string means the * logSessionId is not set. */ std::string mLogSessionId{}; transfer_type mTransfer; transfer_type mTransfer; // Next 5 fields may be changed if IAudioRecord is re-created, but always != 0 // Next 5 fields may be changed if IAudioRecord is re-created, but always != 0 Loading media/libaudioclient/include/media/AudioTrack.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -987,7 +987,8 @@ public: audio_port_handle_t getPortId() const { return mPortId; }; audio_port_handle_t getPortId() const { return mPortId; }; /* Sets the LogSessionId field which is used for metrics association of /* Sets the LogSessionId field which is used for metrics association of * this object with other objects. * this object with other objects. A nullptr or empty string clears * the logSessionId. */ */ void setLogSessionId(const char *logSessionId); void setLogSessionId(const char *logSessionId); Loading Loading @@ -1279,7 +1280,8 @@ public: /** /** * mLogSessionId is a string identifying this AudioTrack for the metrics service. * mLogSessionId is a string identifying this AudioTrack for the metrics service. * It may be unique or shared with other objects. * It may be unique or shared with other objects. An empty string means the * logSessionId is not set. */ */ std::string mLogSessionId{}; std::string mLogSessionId{}; Loading Loading
media/libaudioclient/AudioRecord.cpp +15 −0 Original line number Original line Diff line number Diff line Loading @@ -114,6 +114,7 @@ void AudioRecord::MediaMetrics::gather(const AudioRecord *record) mMetricsItem->setInt32(MM_PREFIX "lastError.code", (int32_t)mLastError); mMetricsItem->setInt32(MM_PREFIX "lastError.code", (int32_t)mLastError); mMetricsItem->setCString(MM_PREFIX "lastError.at", mLastErrorFunc.c_str()); mMetricsItem->setCString(MM_PREFIX "lastError.at", mLastErrorFunc.c_str()); } } mMetricsItem->setCString(MM_PREFIX "logSessionId", record->mLogSessionId.c_str()); } } static const char *stateToString(bool active) { static const char *stateToString(bool active) { Loading Loading @@ -953,6 +954,7 @@ status_t AudioRecord::createRecord_l(const Modulo<uint32_t> &epoch, const String .set(AMEDIAMETRICS_PROP_ORIGINALFLAGS, toString(mOrigFlags).c_str()) .set(AMEDIAMETRICS_PROP_ORIGINALFLAGS, toString(mOrigFlags).c_str()) .set(AMEDIAMETRICS_PROP_SESSIONID, (int32_t)mSessionId) .set(AMEDIAMETRICS_PROP_SESSIONID, (int32_t)mSessionId) .set(AMEDIAMETRICS_PROP_TRACKID, mPortId) .set(AMEDIAMETRICS_PROP_TRACKID, mPortId) .set(AMEDIAMETRICS_PROP_LOGSESSIONID, mLogSessionId) .set(AMEDIAMETRICS_PROP_SOURCE, toString(mAttributes.source).c_str()) .set(AMEDIAMETRICS_PROP_SOURCE, toString(mAttributes.source).c_str()) .set(AMEDIAMETRICS_PROP_THREADID, (int32_t)output.inputId) .set(AMEDIAMETRICS_PROP_THREADID, (int32_t)output.inputId) .set(AMEDIAMETRICS_PROP_SELECTEDDEVICEID, (int32_t)mSelectedDeviceId) .set(AMEDIAMETRICS_PROP_SELECTEDDEVICEID, (int32_t)mSelectedDeviceId) Loading Loading @@ -1574,6 +1576,19 @@ status_t AudioRecord::setPreferredMicrophoneFieldDimension(float zoom) { } } } } void AudioRecord::setLogSessionId(const char *logSessionId) { AutoMutex lock(mLock); if (logSessionId == nullptr) logSessionId = ""; // an empty string is an unset session id. 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 AudioRecord::DeathNotifier::binderDied(const wp<IBinder>& who __unused) void AudioRecord::DeathNotifier::binderDied(const wp<IBinder>& who __unused) Loading
media/libaudioclient/AudioTrack.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3269,6 +3269,7 @@ uint32_t AudioTrack::getUnderrunFrames() const void AudioTrack::setLogSessionId(const char *logSessionId) void AudioTrack::setLogSessionId(const char *logSessionId) { { AutoMutex lock(mLock); AutoMutex lock(mLock); if (logSessionId == nullptr) logSessionId = ""; // an empty string is an unset session id. if (mLogSessionId == logSessionId) return; if (mLogSessionId == logSessionId) return; mLogSessionId = logSessionId; mLogSessionId = logSessionId; Loading
media/libaudioclient/include/media/AudioRecord.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -578,6 +578,12 @@ public: */ */ audio_port_handle_t getPortId() const { return mPortId; }; audio_port_handle_t getPortId() const { return mPortId; }; /* Sets the LogSessionId field which is used for metrics association of * this object with other objects. A nullptr or empty string clears * the logSessionId. */ void setLogSessionId(const char *logSessionId); /* /* * Dumps the state of an audio record. * Dumps the state of an audio record. */ */ Loading Loading @@ -701,6 +707,14 @@ private: audio_session_t mSessionId; audio_session_t mSessionId; audio_port_handle_t mPortId; // Id from Audio Policy Manager audio_port_handle_t mPortId; // Id from Audio Policy Manager /** * mLogSessionId is a string identifying this AudioRecord for the metrics service. * It may be unique or shared with other objects. An empty string means the * logSessionId is not set. */ std::string mLogSessionId{}; transfer_type mTransfer; transfer_type mTransfer; // Next 5 fields may be changed if IAudioRecord is re-created, but always != 0 // Next 5 fields may be changed if IAudioRecord is re-created, but always != 0 Loading
media/libaudioclient/include/media/AudioTrack.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -987,7 +987,8 @@ public: audio_port_handle_t getPortId() const { return mPortId; }; audio_port_handle_t getPortId() const { return mPortId; }; /* Sets the LogSessionId field which is used for metrics association of /* Sets the LogSessionId field which is used for metrics association of * this object with other objects. * this object with other objects. A nullptr or empty string clears * the logSessionId. */ */ void setLogSessionId(const char *logSessionId); void setLogSessionId(const char *logSessionId); Loading Loading @@ -1279,7 +1280,8 @@ public: /** /** * mLogSessionId is a string identifying this AudioTrack for the metrics service. * mLogSessionId is a string identifying this AudioTrack for the metrics service. * It may be unique or shared with other objects. * It may be unique or shared with other objects. An empty string means the * logSessionId is not set. */ */ std::string mLogSessionId{}; std::string mLogSessionId{}; Loading