Merge "qt-dev should be v290000000 and targetSdkVersion=29" into qt-dev
diff --git a/media/codec2/sfplugin/CCodecConfig.cpp b/media/codec2/sfplugin/CCodecConfig.cpp
index 077a91f..1cfdc19 100644
--- a/media/codec2/sfplugin/CCodecConfig.cpp
+++ b/media/codec2/sfplugin/CCodecConfig.cpp
@@ -508,7 +508,7 @@
.limitTo(D::ENCODER & D::VIDEO));
// convert to timestamp base
add(ConfigMapper(KEY_I_FRAME_INTERVAL, C2_PARAMKEY_SYNC_FRAME_INTERVAL, "value")
- .withMapper([](C2Value v) -> C2Value {
+ .withMappers([](C2Value v) -> C2Value {
// convert from i32 to float
int32_t i32Value;
float fpValue;
@@ -518,6 +518,12 @@
return int64_t(c2_min(1000000 * fpValue + 0.5, (double)INT64_MAX));
}
return C2Value();
+ }, [](C2Value v) -> C2Value {
+ int64_t i64;
+ if (v.get(&i64)) {
+ return float(i64) / 1000000;
+ }
+ return C2Value();
}));
// remove when codecs switch to proper coding.gop (add support for calculating gop)
deprecated(ConfigMapper("i-frame-period", "coding.gop", "intra-period")
@@ -711,7 +717,7 @@
// convert to dBFS and add default
add(ConfigMapper(KEY_AAC_DRC_TARGET_REFERENCE_LEVEL, C2_PARAMKEY_DRC_TARGET_REFERENCE_LEVEL, "value")
- .limitTo(D::AUDIO & D::DECODER)
+ .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
@@ -722,7 +728,7 @@
// convert to 0-1 (%) and add default
add(ConfigMapper(KEY_AAC_DRC_ATTENUATION_FACTOR, C2_PARAMKEY_DRC_ATTENUATION_FACTOR, "value")
- .limitTo(D::AUDIO & D::DECODER)
+ .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
@@ -733,7 +739,7 @@
// convert to 0-1 (%) and add default
add(ConfigMapper(KEY_AAC_DRC_BOOST_FACTOR, C2_PARAMKEY_DRC_BOOST_FACTOR, "value")
- .limitTo(D::AUDIO & D::DECODER)
+ .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
@@ -744,7 +750,7 @@
// convert to compression type and add default
add(ConfigMapper(KEY_AAC_DRC_HEAVY_COMPRESSION, C2_PARAMKEY_DRC_COMPRESSION_MODE, "value")
- .limitTo(D::AUDIO & D::DECODER)
+ .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
@@ -755,7 +761,7 @@
// convert to dBFS and add default
add(ConfigMapper(KEY_AAC_ENCODED_TARGET_LEVEL, C2_PARAMKEY_DRC_ENCODED_TARGET_LEVEL, "value")
- .limitTo(D::AUDIO & D::DECODER)
+ .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
@@ -766,7 +772,7 @@
// convert to effect type (these map to SDK values) and add default
add(ConfigMapper(KEY_AAC_DRC_EFFECT_TYPE, C2_PARAMKEY_DRC_EFFECT_TYPE, "value")
- .limitTo(D::AUDIO & D::DECODER)
+ .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < -1 || value > 8) {
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index 5a58aa0..5c77e41 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -90,8 +90,11 @@
ALOGV("resetDataSource");
mHTTPService.clear();
- mHttpSource.clear();
- mDisconnected = false;
+ {
+ Mutex::Autolock _l_d(mDisconnectLock);
+ mHttpSource.clear();
+ mDisconnected = false;
+ }
mUri.clear();
mUriHeaders.clear();
mSources.clear();
@@ -152,7 +155,10 @@
ALOGV("setDataSource (source: %p)", source.get());
resetDataSource();
- mDataSource = source;
+ {
+ Mutex::Autolock _l_d(mDisconnectLock);
+ mDataSource = source;
+ }
return OK;
}
@@ -163,8 +169,12 @@
status_t NuPlayer::GenericSource::initFromDataSource() {
sp<IMediaExtractor> extractor;
- CHECK(mDataSource != NULL);
- sp<DataSource> dataSource = mDataSource;
+ sp<DataSource> dataSource;
+ {
+ Mutex::Autolock _l_d(mDisconnectLock);
+ dataSource = mDataSource;
+ }
+ CHECK(dataSource != NULL);
mLock.unlock();
// This might take long time if data source is not reliable.
@@ -359,6 +369,7 @@
}
void NuPlayer::GenericSource::onPrepareAsync() {
+ mDisconnectLock.lock();
ALOGV("onPrepareAsync: mDataSource: %d", (mDataSource != NULL));
// delayed data source creation
@@ -372,20 +383,30 @@
String8 contentType;
if (!strncasecmp("http://", uri, 7) || !strncasecmp("https://", uri, 8)) {
- mHttpSource = DataSourceFactory::CreateMediaHTTP(mHTTPService);
- if (mHttpSource == NULL) {
+ sp<DataSource> httpSource;
+ mDisconnectLock.unlock();
+ httpSource = DataSourceFactory::CreateMediaHTTP(mHTTPService);
+ if (httpSource == NULL) {
ALOGE("Failed to create http source!");
notifyPreparedAndCleanup(UNKNOWN_ERROR);
+ mDisconnectLock.lock();
return;
}
+ mDisconnectLock.lock();
+
+ if (!mDisconnected) {
+ mHttpSource = httpSource;
+ }
}
mLock.unlock();
+ mDisconnectLock.unlock();
// This might take long time if connection has some issue.
sp<DataSource> dataSource = DataSourceFactory::CreateFromURI(
mHTTPService, uri, &mUriHeaders, &contentType,
static_cast<HTTPBase *>(mHttpSource.get()));
mLock.lock();
+ mDisconnectLock.lock();
if (!mDisconnected) {
mDataSource = dataSource;
}
@@ -437,6 +458,8 @@
mCachedSource = static_cast<NuCachedSource2 *>(mDataSource.get());
}
+ mDisconnectLock.unlock();
+
// For cached streaming cases, we need to wait for enough
// buffering before reporting prepared.
mIsStreaming = (mCachedSource != NULL);
@@ -503,9 +526,13 @@
void NuPlayer::GenericSource::notifyPreparedAndCleanup(status_t err) {
if (err != OK) {
- mDataSource.clear();
+ {
+ Mutex::Autolock _l_d(mDisconnectLock);
+ mDataSource.clear();
+ mHttpSource.clear();
+ }
+
mCachedSource.clear();
- mHttpSource.clear();
mBitrate = -1;
mPrevBufferPercentage = -1;
@@ -547,7 +574,7 @@
void NuPlayer::GenericSource::disconnect() {
sp<DataSource> dataSource, httpSource;
{
- Mutex::Autolock _l(mLock);
+ Mutex::Autolock _l_d(mDisconnectLock);
dataSource = mDataSource;
httpSource = mHttpSource;
mDisconnected = true;
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.h b/media/libmediaplayerservice/nuplayer/GenericSource.h
index 065cac1..4d1905d 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.h
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.h
@@ -170,6 +170,7 @@
sp<ABuffer> mGlobalTimedText;
mutable Mutex mLock;
+ mutable Mutex mDisconnectLock; // Protects mDataSource, mHttpSource and mDisconnected
sp<ALooper> mLooper;
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
index dca84c0..c42923a 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
@@ -120,8 +120,9 @@
ALOGV("getAudioPolicyMix() for dev=0x%x addr=%s", deviceType, address.string());
for (ssize_t i = 0; i < size(); i++) {
- if (itemAt(i)->mDeviceType == deviceType
- && itemAt(i)->mDeviceAddress.compare(address) == 0) {
+ // Workaround: when an in audio policy is registered, it opens an output
+ // that tries to find the audio policy, thus the device must be ignored.
+ if (itemAt(i)->mDeviceAddress.compare(address) == 0) {
policyMix = itemAt(i);
ALOGV("getAudioPolicyMix: found mix %zu match (devType=0x%x addr=%s)",
i, deviceType, address.string());
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.cpp b/services/camera/libcameraservice/device3/Camera3Stream.cpp
index 6d76802..2df084b 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Stream.cpp
@@ -60,6 +60,8 @@
mUsage(0),
mOldUsage(0),
mOldMaxBuffers(0),
+ mOldFormat(-1),
+ mOldDataSpace(HAL_DATASPACE_UNKNOWN),
mPrepared(false),
mPrepareBlockRequest(true),
mPreparedBufferIdx(0),
@@ -256,6 +258,8 @@
mOldUsage = mUsage;
mOldMaxBuffers = camera3_stream::max_buffers;
+ mOldFormat = camera3_stream::format;
+ mOldDataSpace = camera3_stream::data_space;
res = getEndpointUsage(&mUsage);
if (res != OK) {
@@ -330,7 +334,9 @@
// so. As documented in hardware/camera3.h:configure_streams().
if (mState == STATE_IN_RECONFIG &&
mOldUsage == mUsage &&
- mOldMaxBuffers == camera3_stream::max_buffers && !mDataSpaceOverridden) {
+ mOldMaxBuffers == camera3_stream::max_buffers &&
+ mOldDataSpace == camera3_stream::data_space &&
+ mOldFormat == camera3_stream::format) {
mState = STATE_CONFIGURED;
return OK;
}
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.h b/services/camera/libcameraservice/device3/Camera3Stream.h
index c916fe8..533318f 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.h
+++ b/services/camera/libcameraservice/device3/Camera3Stream.h
@@ -540,8 +540,12 @@
uint64_t mUsage;
private:
+ // Previously configured stream properties (post HAL override)
uint64_t mOldUsage;
uint32_t mOldMaxBuffers;
+ int mOldFormat;
+ android_dataspace mOldDataSpace;
+
Condition mOutputBufferReturnedSignal;
Condition mInputBufferReturnedSignal;
static const nsecs_t kWaitForBufferDuration = 3000000000LL; // 3000 ms