Merge "CCodec: do not update frame size with buffer dimensions" into sc-dev
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 9e9bdfc..e9adfc9 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -1881,13 +1881,7 @@
}
}
- bool drop = false;
- if (worklet->output.flags & C2FrameData::FLAG_DROP_FRAME) {
- ALOGV("[%s] onWorkDone: drop buffer but keep metadata", mName);
- drop = true;
- }
-
- if (notifyClient && !buffer && !flags && !(drop && outputFormat)) {
+ if (notifyClient && !buffer && !flags) {
ALOGV("[%s] onWorkDone: Not reporting output buffer (%lld)",
mName, work->input.ordinal.frameIndex.peekull());
notifyClient = false;
@@ -1914,7 +1908,7 @@
return false;
}
output->buffers->pushToStash(
- drop ? nullptr : buffer,
+ buffer,
notifyClient,
timestamp.peek(),
flags,
diff --git a/media/libaaudio/src/client/AudioStreamInternal.cpp b/media/libaaudio/src/client/AudioStreamInternal.cpp
index cf2abe8..6d2d464 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternal.cpp
@@ -155,8 +155,11 @@
// This must match the key generated in oboeservice/AAudioServiceStreamBase.cpp
// so the client can have permission to log.
- mMetricsId = std::string(AMEDIAMETRICS_KEY_PREFIX_AUDIO_STREAM)
- + std::to_string(mServiceStreamHandle);
+ if (!mInService) {
+ // No need to log if it is from service side.
+ mMetricsId = std::string(AMEDIAMETRICS_KEY_PREFIX_AUDIO_STREAM)
+ + std::to_string(mServiceStreamHandle);
+ }
android::mediametrics::LogItem(mMetricsId)
.set(AMEDIAMETRICS_PROP_PERFORMANCEMODE,
diff --git a/services/mediametrics/AudioAnalytics.cpp b/services/mediametrics/AudioAnalytics.cpp
index 11ec993..45c9f56 100644
--- a/services/mediametrics/AudioAnalytics.cpp
+++ b/services/mediametrics/AudioAnalytics.cpp
@@ -24,6 +24,7 @@
#include <audio_utils/clock.h> // clock conversions
#include <cutils/properties.h>
#include <statslog.h> // statsd
+#include <system/audio.h>
#include "AudioTypes.h" // string to int conversions
#include "MediaMetricsService.h" // package info
@@ -957,6 +958,25 @@
int32_t channelCount = -1;
mAudioAnalytics.mAnalyticsState->timeMachine().get(
key, AMEDIAMETRICS_PROP_CHANNELCOUNT, &channelCount);
+ if (channelCount == -1) {
+ // Try to get channel count from channel mask. From the legacy path,
+ // only channel mask are logged.
+ int32_t channelMask = 0;
+ mAudioAnalytics.mAnalyticsState->timeMachine().get(
+ key, AMEDIAMETRICS_PROP_CHANNELMASK, &channelMask);
+ if (channelMask != 0) {
+ switch (direction) {
+ case 1: // Output, keep sync with AudioTypes#getAAudioDirection()
+ channelCount = audio_channel_count_from_out_mask(channelMask);
+ break;
+ case 2: // Input, keep sync with AudioTypes#getAAudioDirection()
+ channelCount = audio_channel_count_from_in_mask(channelMask);
+ break;
+ default:
+ ALOGW("Invalid direction %d", direction);
+ }
+ }
+ }
int64_t totalFramesTransferred = -1;
mAudioAnalytics.mAnalyticsState->timeMachine().get(