Merge "audioflinger: pause direct output when buffer timeout" into sc-dev
diff --git a/media/codec2/core/include/C2Config.h b/media/codec2/core/include/C2Config.h
index 8ee5f33..6176646 100644
--- a/media/codec2/core/include/C2Config.h
+++ b/media/codec2/core/include/C2Config.h
@@ -75,6 +75,10 @@
enum tiling_mode_t : uint32_t; ///< tiling modes
};
+struct C2PlatformConfig {
+ enum encoding_quality_level_t : uint32_t; ///< encoding quality level
+};
+
namespace {
enum C2ParamIndexKind : C2Param::type_index_t {
@@ -259,7 +263,11 @@
kParamIndexTunnelHandle, // int32[]
kParamIndexTunnelSystemTime, // int64
+ // dmabuf allocator
kParamIndexStoreDmaBufUsage, // store, struct
+
+ // encoding quality requirements
+ kParamIndexEncodingQualityLevel, // encoders, enum
};
}
@@ -2340,6 +2348,23 @@
C2PortTunnelSystemTime;
constexpr char C2_PARAMKEY_OUTPUT_RENDER_TIME[] = "output.render-time";
+C2ENUM(C2PlatformConfig::encoding_quality_level_t, uint32_t,
+ NONE,
+ S_HANDHELD,
+ S_HANDHELD_PC
+);
+
+namespace android {
+
+/**
+ * Encoding quality level signaling.
+ */
+typedef C2GlobalParam<C2Setting,
+ C2SimpleValueStruct<C2EasyEnum<C2PlatformConfig::encoding_quality_level_t>>,
+ kParamIndexEncodingQualityLevel> C2EncodingQualityLevel;
+
+}
+
/// @}
#endif // C2CONFIG_H_
diff --git a/media/libaaudio/src/client/AudioStreamInternal.cpp b/media/libaaudio/src/client/AudioStreamInternal.cpp
index dc961ad..bf07abb 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternal.cpp
@@ -100,8 +100,9 @@
const int32_t burstMinMicros = AAudioProperty_getHardwareBurstMinMicros();
int32_t burstMicros = 0;
+ const audio_format_t requestedFormat = getFormat();
// We have to do volume scaling. So we prefer FLOAT format.
- if (getFormat() == AUDIO_FORMAT_DEFAULT) {
+ if (requestedFormat == AUDIO_FORMAT_DEFAULT) {
setFormat(AUDIO_FORMAT_PCM_FLOAT);
}
// Request FLOAT for the shared mixer or the device.
@@ -156,6 +157,12 @@
mMetricsId = std::string(AMEDIAMETRICS_KEY_PREFIX_AUDIO_STREAM)
+ std::to_string(mServiceStreamHandle);
+ android::mediametrics::LogItem(mMetricsId)
+ .set(AMEDIAMETRICS_PROP_PERFORMANCEMODE,
+ AudioGlobal_convertPerformanceModeToText(getPerformanceMode()))
+ .set(AMEDIAMETRICS_PROP_ENCODINGCLIENT,
+ android::toString(requestedFormat).c_str()).record();
+
result = configurationOutput.validate();
if (result != AAUDIO_OK) {
goto error;
diff --git a/media/libaaudio/src/core/AudioStream.cpp b/media/libaaudio/src/core/AudioStream.cpp
index ef83c8e..91b8a4d 100644
--- a/media/libaaudio/src/core/AudioStream.cpp
+++ b/media/libaaudio/src/core/AudioStream.cpp
@@ -56,16 +56,6 @@
ALOGE_IF(mHasThread, "%s() callback thread never join()ed", __func__);
- if (!mMetricsId.empty()) {
- android::mediametrics::LogItem(mMetricsId)
- .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_ENDAAUDIOSTREAM)
- .set(AMEDIAMETRICS_PROP_ENCODINGREQUESTED,
- android::toString(mDeviceFormat).c_str())
- .set(AMEDIAMETRICS_PROP_PERFORMANCEMODEACTUAL,
- AudioGlobal_convertPerformanceModeToText(getPerformanceMode()))
- .record();
- }
-
// If the stream is deleted when OPEN or in use then audio resources will leak.
// This would indicate an internal error. So we want to find this ASAP.
LOG_ALWAYS_FATAL_IF(!(getState() == AAUDIO_STREAM_STATE_CLOSED
@@ -121,11 +111,11 @@
return AAUDIO_OK;
}
-void AudioStream::logOpen() {
+void AudioStream::logOpenActual() {
if (mMetricsId.size() > 0) {
android::mediametrics::LogItem item(mMetricsId);
item.set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_OPEN)
- .set(AMEDIAMETRICS_PROP_PERFORMANCEMODE,
+ .set(AMEDIAMETRICS_PROP_PERFORMANCEMODEACTUAL,
AudioGlobal_convertPerformanceModeToText(getPerformanceMode()))
.set(AMEDIAMETRICS_PROP_SHARINGMODE,
AudioGlobal_convertSharingModeToText(getSharingMode()))
@@ -359,6 +349,7 @@
.set(AMEDIAMETRICS_PROP_FRAMESTRANSFERRED,
getDirection() == AAUDIO_DIRECTION_INPUT ? getFramesWritten()
: getFramesRead())
+ .set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_ENDAAUDIOSTREAM)
.record();
}
}
diff --git a/media/libaaudio/src/core/AudioStream.h b/media/libaaudio/src/core/AudioStream.h
index 3930964..2b45ed3 100644
--- a/media/libaaudio/src/core/AudioStream.h
+++ b/media/libaaudio/src/core/AudioStream.h
@@ -118,7 +118,7 @@
virtual aaudio_result_t open(const AudioStreamBuilder& builder);
// log to MediaMetrics
- virtual void logOpen();
+ virtual void logOpenActual();
void logReleaseBufferState();
/* Note about naming for "release" and "close" related methods.
diff --git a/media/libaaudio/src/core/AudioStreamBuilder.cpp b/media/libaaudio/src/core/AudioStreamBuilder.cpp
index 207a8e3..2135c54 100644
--- a/media/libaaudio/src/core/AudioStreamBuilder.cpp
+++ b/media/libaaudio/src/core/AudioStreamBuilder.cpp
@@ -189,7 +189,7 @@
}
if (result == AAUDIO_OK) {
audioStream->registerPlayerBase();
- audioStream->logOpen();
+ audioStream->logOpenActual();
*streamPtr = startUsingStream(audioStream);
} // else audioStream will go out of scope and be deleted
}
diff --git a/media/libaaudio/src/legacy/AudioStreamRecord.cpp b/media/libaaudio/src/legacy/AudioStreamRecord.cpp
index e3ac6ff..de8fe6a 100644
--- a/media/libaaudio/src/legacy/AudioStreamRecord.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamRecord.cpp
@@ -26,6 +26,7 @@
#include <media/AudioRecord.h>
#include <utils/String16.h>
+#include "core/AudioGlobal.h"
#include "legacy/AudioStreamLegacy.h"
#include "legacy/AudioStreamRecord.h"
#include "utility/AudioClock.h"
@@ -92,8 +93,9 @@
break;
}
+ const audio_format_t requestedFormat = getFormat();
// Preserve behavior of API 26
- if (getFormat() == AUDIO_FORMAT_DEFAULT) {
+ if (requestedFormat == AUDIO_FORMAT_DEFAULT) {
setFormat(AUDIO_FORMAT_PCM_FLOAT);
}
@@ -217,6 +219,10 @@
mMetricsId = std::string(AMEDIAMETRICS_KEY_PREFIX_AUDIO_RECORD)
+ std::to_string(mAudioRecord->getPortId());
+ android::mediametrics::LogItem(mMetricsId)
+ .set(AMEDIAMETRICS_PROP_PERFORMANCEMODE,
+ AudioGlobal_convertPerformanceModeToText(getPerformanceMode()))
+ .set(AMEDIAMETRICS_PROP_ENCODINGCLIENT, toString(requestedFormat).c_str()).record();
// Get the actual values from the AudioRecord.
setSamplesPerFrame(mAudioRecord->channelCount());
diff --git a/media/libaaudio/src/legacy/AudioStreamTrack.cpp b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
index df97658..2ee5cdc 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
@@ -23,9 +23,11 @@
#include <aaudio/AAudio.h>
#include <system/audio.h>
-#include "utility/AudioClock.h"
+
+#include "core/AudioGlobal.h"
#include "legacy/AudioStreamLegacy.h"
#include "legacy/AudioStreamTrack.h"
+#include "utility/AudioClock.h"
#include "utility/FixedBlockReader.h"
using namespace android;
@@ -187,6 +189,10 @@
mMetricsId = std::string(AMEDIAMETRICS_KEY_PREFIX_AUDIO_TRACK)
+ std::to_string(mAudioTrack->getPortId());
+ android::mediametrics::LogItem(mMetricsId)
+ .set(AMEDIAMETRICS_PROP_PERFORMANCEMODE,
+ AudioGlobal_convertPerformanceModeToText(getPerformanceMode()))
+ .set(AMEDIAMETRICS_PROP_ENCODINGCLIENT, toString(getFormat()).c_str()).record();
doSetVolume();
diff --git a/media/libmediametrics/include/MediaMetricsConstants.h b/media/libmediametrics/include/MediaMetricsConstants.h
index 383bae8..66108df 100644
--- a/media/libmediametrics/include/MediaMetricsConstants.h
+++ b/media/libmediametrics/include/MediaMetricsConstants.h
@@ -160,9 +160,9 @@
#define AMEDIAMETRICS_PROP_VOLUME_LEFT "volume.left" // double (AudioTrack)
#define AMEDIAMETRICS_PROP_VOLUME_RIGHT "volume.right" // double (AudioTrack)
#define AMEDIAMETRICS_PROP_WHERE "where" // string value
-// EncodingRequested is the encoding format requested by the app
-#define AMEDIAMETRICS_PROP_ENCODINGREQUESTED "encodingRequested" // string
-// PerformanceModeActual is the actual selected performance mode, could be "none', "loeLatency" or
+// EncodingClient is the encoding format requested by the client
+#define AMEDIAMETRICS_PROP_ENCODINGCLIENT "encodingClient" // string
+// PerformanceModeActual is the actual selected performance mode, could be "none', "lowLatency" or
// "powerSaving"
#define AMEDIAMETRICS_PROP_PERFORMANCEMODEACTUAL "performanceModeActual" // string
#define AMEDIAMETRICS_PROP_FRAMESTRANSFERRED "framesTransferred" // int64_t, transferred frames
diff --git a/media/libstagefright/foundation/Android.bp b/media/libstagefright/foundation/Android.bp
index 7655d90..4bfc673 100644
--- a/media/libstagefright/foundation/Android.bp
+++ b/media/libstagefright/foundation/Android.bp
@@ -45,6 +45,9 @@
],
header_libs: [
+ // this is only needed for the vendor variant that removes libbinder, but vendor
+ // target below does not allow adding header_libs.
+ "libbinder_headers",
"libstagefright_foundation_headers",
"media_ndk_headers",
"media_plugin_headers",
@@ -98,6 +101,7 @@
target: {
vendor: {
+ // TODO: add libbinder_headers here instead of above when it becomes supported
exclude_shared_libs: [
"libbinder",
],
diff --git a/services/mediametrics/AudioAnalytics.cpp b/services/mediametrics/AudioAnalytics.cpp
index dbc68b2..fe86264 100644
--- a/services/mediametrics/AudioAnalytics.cpp
+++ b/services/mediametrics/AudioAnalytics.cpp
@@ -987,7 +987,7 @@
std::string formatAppStr;
mAudioAnalytics.mAnalyticsState->timeMachine().get(
- key, AMEDIAMETRICS_PROP_ENCODINGREQUESTED, &formatAppStr);
+ key, AMEDIAMETRICS_PROP_ENCODINGCLIENT, &formatAppStr);
const auto formatApp = types::lookup<types::ENCODING, int32_t>(formatAppStr);
std::string formatDeviceStr;