Merge "mpeg4enc: Ignore integer overflow in encoder idct functions" am: 01fd6fefb1 am: ac8e138cdb
Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1772936
Change-Id: Iae3530c53bb2a087627662c4fc4686e3f4b9260f
diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h
index 52cd4b4..86781e5 100644
--- a/camera/ndk/include/camera/NdkCameraMetadataTags.h
+++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h
@@ -9005,7 +9005,12 @@
* <code>android.scaler.streamConfigurationMap</code> describes the streams supported in 'default'
* mode.
* The stream configurations supported in 'max resolution' mode are described by
- * <code>android.scaler.streamConfigurationMapMaximumResolution</code>.</p>
+ * <code>android.scaler.streamConfigurationMapMaximumResolution</code>.
+ * The maximum resolution mode pixel array size of a camera device
+ * (<code>ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE</code>) with this capability,
+ * will be at least 24 megapixels.</p>
+ *
+ * @see ACAMERA_SENSOR_INFO_PIXEL_ARRAY_SIZE
*/
ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR
= 16,
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index a2cac3f..6cb0a99 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -53,10 +53,8 @@
Mutex::Autolock lock(sMutex);
if (NULL == sDrmManagerService.get()) {
sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> binder = sm->getService(String16("drm.drmManager"));
+ sp<IBinder> binder = sm->checkService(String16("drm.drmManager"));
if (binder == NULL) {
- // Do NOT retry; IServiceManager already waits for ~5 seconds
- // in getService if a service doesn't yet exist.
return sDrmManagerService;
}
if (NULL == sDeathNotifier.get()) {
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 16398a4..82460c9 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1566,15 +1566,36 @@
// we are now using surface - apply default color aspects to input format - as well as
// get dataspace
bool inputFormatChanged = config->updateFormats(Config::IS_INPUT);
- ALOGD("input format %s to %s",
- inputFormatChanged ? "changed" : "unchanged",
- config->mInputFormat->debugString().c_str());
// configure dataspace
static_assert(sizeof(int32_t) == sizeof(android_dataspace), "dataspace size mismatch");
- android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN;
- (void)config->mInputFormat->findInt32("android._dataspace", (int32_t*)&dataSpace);
+
+ // The output format contains app-configured color aspects, and the input format
+ // has the default color aspects. Use the default for the unspecified params.
+ ColorAspects inputColorAspects, colorAspects;
+ getColorAspectsFromFormat(config->mOutputFormat, colorAspects);
+ getColorAspectsFromFormat(config->mInputFormat, inputColorAspects);
+ if (colorAspects.mRange == ColorAspects::RangeUnspecified) {
+ colorAspects.mRange = inputColorAspects.mRange;
+ }
+ if (colorAspects.mPrimaries == ColorAspects::PrimariesUnspecified) {
+ colorAspects.mPrimaries = inputColorAspects.mPrimaries;
+ }
+ if (colorAspects.mTransfer == ColorAspects::TransferUnspecified) {
+ colorAspects.mTransfer = inputColorAspects.mTransfer;
+ }
+ if (colorAspects.mMatrixCoeffs == ColorAspects::MatrixUnspecified) {
+ colorAspects.mMatrixCoeffs = inputColorAspects.mMatrixCoeffs;
+ }
+ android_dataspace dataSpace = getDataSpaceForColorAspects(
+ colorAspects, /* mayExtend = */ false);
surface->setDataSpace(dataSpace);
+ setColorAspectsIntoFormat(colorAspects, config->mInputFormat, /* force = */ true);
+ config->mInputFormat->setInt32("android._dataspace", int32_t(dataSpace));
+
+ ALOGD("input format %s to %s",
+ inputFormatChanged ? "changed" : "unchanged",
+ config->mInputFormat->debugString().c_str());
status_t err = mChannel->setInputSurface(surface);
if (err != OK) {
@@ -2262,8 +2283,6 @@
const C2ConstGraphicBlock &block = blocks[0];
updates.emplace_back(new C2StreamCropRectInfo::output(
stream, block.crop()));
- updates.emplace_back(new C2StreamPictureSizeInfo::output(
- stream, block.crop().width, block.crop().height));
}
++stream;
}
diff --git a/media/codec2/sfplugin/Codec2Buffer.cpp b/media/codec2/sfplugin/Codec2Buffer.cpp
index 4070478..62c8fcd 100644
--- a/media/codec2/sfplugin/Codec2Buffer.cpp
+++ b/media/codec2/sfplugin/Codec2Buffer.cpp
@@ -248,7 +248,10 @@
// align width and height to support subsampling cleanly
uint32_t stride = align(view.crop().width, 2) * divUp(layout.planes[0].allocatedDepth, 8u);
- uint32_t vStride = align(view.crop().height, 2);
+
+ int32_t fmtHeight = mHeight;
+ format->findInt32(KEY_HEIGHT, &fmtHeight);
+ uint32_t vStride = align(fmtHeight, 2);
bool tryWrapping = !copy;
diff --git a/media/extractors/tests/Android.bp b/media/extractors/tests/Android.bp
index 5d97d9a..23c74f7 100644
--- a/media/extractors/tests/Android.bp
+++ b/media/extractors/tests/Android.bp
@@ -45,14 +45,11 @@
"libdatasource",
"libwatchdog",
- "libstagefright",
"libstagefright_id3",
"libstagefright_flacdec",
"libstagefright_esds",
"libstagefright_mpeg2support",
- "libstagefright_mpeg2extractor",
"libstagefright_foundation_colorutils_ndk",
- "libstagefright_foundation",
"libstagefright_metadatautils",
"libmedia_midiiowrapper",
@@ -74,6 +71,8 @@
"libcutils",
"libmediandk",
"libmedia",
+ "libstagefright",
+ "libstagefright_foundation",
"libcrypto",
"libhidlmemory",
"libhidlbase",
diff --git a/media/libaudiohal/impl/DeviceHalHidl.cpp b/media/libaudiohal/impl/DeviceHalHidl.cpp
index ca4f663..02d66ae 100644
--- a/media/libaudiohal/impl/DeviceHalHidl.cpp
+++ b/media/libaudiohal/impl/DeviceHalHidl.cpp
@@ -463,6 +463,18 @@
hidlHandle->data[0] = fd;
Return<void> ret = mDevice->debug(hidlHandle, {} /* options */);
native_handle_delete(hidlHandle);
+
+ // TODO(b/111997867, b/177271958) Workaround - remove when fixed.
+ // A Binder transmitted fd may not close immediately due to a race condition b/111997867
+ // when the remote binder thread removes the last refcount to the fd blocks in the
+ // kernel for binder activity. We send a Binder ping() command to unblock the thread
+ // and complete the fd close / release.
+ //
+ // See DeviceHalHidl::dump(), EffectHalHidl::dump(), StreamHalHidl::dump(),
+ // EffectsFactoryHalHidl::dumpEffects().
+
+ (void)mDevice->ping(); // synchronous Binder call
+
return processReturn("dump", ret);
}
diff --git a/media/libaudiohal/impl/EffectHalHidl.cpp b/media/libaudiohal/impl/EffectHalHidl.cpp
index c589a48..51ad146 100644
--- a/media/libaudiohal/impl/EffectHalHidl.cpp
+++ b/media/libaudiohal/impl/EffectHalHidl.cpp
@@ -239,6 +239,18 @@
hidlHandle->data[0] = fd;
Return<void> ret = mEffect->debug(hidlHandle, {} /* options */);
native_handle_delete(hidlHandle);
+
+ // TODO(b/111997867, b/177271958) Workaround - remove when fixed.
+ // A Binder transmitted fd may not close immediately due to a race condition b/111997867
+ // when the remote binder thread removes the last refcount to the fd blocks in the
+ // kernel for binder activity. We send a Binder ping() command to unblock the thread
+ // and complete the fd close / release.
+ //
+ // See DeviceHalHidl::dump(), EffectHalHidl::dump(), StreamHalHidl::dump(),
+ // EffectsFactoryHalHidl::dumpEffects().
+
+ (void)mEffect->ping(); // synchronous Binder call
+
return ret.isOk() ? OK : FAILED_TRANSACTION;
}
diff --git a/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp b/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
index 9c4363c..f042b92 100644
--- a/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
+++ b/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
@@ -149,6 +149,18 @@
hidlHandle->data[0] = fd;
Return<void> ret = mEffectsFactory->debug(hidlHandle, {} /* options */);
native_handle_delete(hidlHandle);
+
+ // TODO(b/111997867, b/177271958) Workaround - remove when fixed.
+ // A Binder transmitted fd may not close immediately due to a race condition b/111997867
+ // when the remote binder thread removes the last refcount to the fd blocks in the
+ // kernel for binder activity. We send a Binder ping() command to unblock the thread
+ // and complete the fd close / release.
+ //
+ // See DeviceHalHidl::dump(), EffectHalHidl::dump(), StreamHalHidl::dump(),
+ // EffectsFactoryHalHidl::dumpEffects().
+
+ (void)mEffectsFactory->ping(); // synchronous Binder call
+
return processReturn(__FUNCTION__, ret);
}
diff --git a/media/libaudiohal/impl/StreamHalHidl.cpp b/media/libaudiohal/impl/StreamHalHidl.cpp
index 539a149..129b1c1 100644
--- a/media/libaudiohal/impl/StreamHalHidl.cpp
+++ b/media/libaudiohal/impl/StreamHalHidl.cpp
@@ -158,6 +158,18 @@
hidlHandle->data[0] = fd;
Return<void> ret = mStream->debug(hidlHandle, {} /* options */);
native_handle_delete(hidlHandle);
+
+ // TODO(b/111997867, b/177271958) Workaround - remove when fixed.
+ // A Binder transmitted fd may not close immediately due to a race condition b/111997867
+ // when the remote binder thread removes the last refcount to the fd blocks in the
+ // kernel for binder activity. We send a Binder ping() command to unblock the thread
+ // and complete the fd close / release.
+ //
+ // See DeviceHalHidl::dump(), EffectHalHidl::dump(), StreamHalHidl::dump(),
+ // EffectsFactoryHalHidl::dumpEffects().
+
+ (void)mStream->ping(); // synchronous Binder call
+
mStreamPowerLog.dump(fd);
return processReturn("dump", ret);
}
diff --git a/media/libmediatranscoding/OWNERS b/media/libmediatranscoding/OWNERS
index c2d2632..b08d573 100644
--- a/media/libmediatranscoding/OWNERS
+++ b/media/libmediatranscoding/OWNERS
@@ -1,3 +1,5 @@
+chz@google.com
gokrishnan@google.com
hkuang@google.com
lnilsson@google.com
+pawin@google.com
diff --git a/media/tests/SampleVideoEncoder/app/src/main/AndroidManifest.xml b/media/tests/SampleVideoEncoder/app/src/main/AndroidManifest.xml
index b17541d..75d73bf 100644
--- a/media/tests/SampleVideoEncoder/app/src/main/AndroidManifest.xml
+++ b/media/tests/SampleVideoEncoder/app/src/main/AndroidManifest.xml
@@ -30,7 +30,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
- <activity android:name="com.android.media.samplevideoencoder.MainActivity">
+ <activity android:name="com.android.media.samplevideoencoder.MainActivity"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -42,4 +43,4 @@
android:targetPackage="com.android.media.samplevideoencoder"
android:label="SampleVideoEncoder Test"/>
-</manifest>
\ No newline at end of file
+</manifest>