C2 VTS: Cleanup code around query() calls am: f1c7514ab7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/15881020
Change-Id: I3302f016db6ea61f264c62d0264c8f1d0c5c09c2
diff --git a/OWNERS b/OWNERS
index 7f523a2..0be1196 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,10 +1,8 @@
-chz@google.com
+# Bug component: 1344
elaurent@google.com
etalvala@google.com
hkuang@google.com
lajos@google.com
-marcone@google.com
-# LON
-olly@google.com
-andrewlewis@google.com
+# go/android-fwk-media-solutions for info on areas of ownership.
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
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/OWNERS b/media/OWNERS
index 3e194f0..4cf4870 100644
--- a/media/OWNERS
+++ b/media/OWNERS
@@ -1,24 +1,20 @@
-andrewlewis@google.com
-chz@google.com
-dwkang@google.com
+# Bug component: 1344
elaurent@google.com
essick@google.com
-gkasten@google.com
hkuang@google.com
hunga@google.com
jiabin@google.com
jmtrivi@google.com
lajos@google.com
-marcone@google.com
mnaganov@google.com
nchalko@google.com
-pawin@google.com
philburk@google.com
pmclean@google.com
quxiangfang@google.com
-rachad@google.com
rago@google.com
robertshih@google.com
taklee@google.com
-wjia@google.com
wonsik@google.com
+
+# go/android-fwk-media-solutions for info on areas of ownership.
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
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/CCodecBuffers.cpp b/media/codec2/sfplugin/CCodecBuffers.cpp
index 29cc564..333a2ca 100644
--- a/media/codec2/sfplugin/CCodecBuffers.cpp
+++ b/media/codec2/sfplugin/CCodecBuffers.cpp
@@ -96,7 +96,10 @@
if (img->mNumPlanes > 0 && img->mType != img->MEDIA_IMAGE_TYPE_UNKNOWN) {
int32_t stride = img->mPlane[0].mRowInc;
mFormatWithImageData->setInt32(KEY_STRIDE, stride);
- ALOGD("[%s] updating stride = %d", mName, stride);
+ mFormatWithImageData->setInt32(KEY_WIDTH, img->mWidth);
+ mFormatWithImageData->setInt32(KEY_HEIGHT, img->mHeight);
+ ALOGD("[%s] updating stride = %d, width: %d, height: %d",
+ mName, stride, img->mWidth, img->mHeight);
if (img->mNumPlanes > 1 && stride > 0) {
int64_t offsetDelta =
(int64_t)img->mPlane[1].mOffset - (int64_t)img->mPlane[0].mOffset;
diff --git a/media/janitors/media_solutions_OWNERS b/media/janitors/media_solutions_OWNERS
new file mode 100644
index 0000000..8dc1c7b
--- /dev/null
+++ b/media/janitors/media_solutions_OWNERS
@@ -0,0 +1,10 @@
+# Bug component: 1344
+# go/android-fwk-media-solutions for info on areas of ownership.
+
+# Main owners:
+aquilescanta@google.com
+krocard@google.com
+
+# In case of emergency:
+andrewlewis@google.com #{LAST_RESORT_SUGGESTION}
+olly@google.com #{LAST_RESORT_SUGGESTION}
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/libstagefright/OWNERS b/media/libstagefright/OWNERS
index 0cc2294..e67496e 100644
--- a/media/libstagefright/OWNERS
+++ b/media/libstagefright/OWNERS
@@ -1,11 +1,9 @@
+# Bug component: 1344
set noparent
-chz@google.com
essick@google.com
lajos@google.com
-marcone@google.com
taklee@google.com
wonsik@google.com
-# LON
-olly@google.com
-andrewlewis@google.com
+# go/android-fwk-media-solutions for info on areas of ownership.
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp
index ffccbb1..0bd342a 100644
--- a/media/libstagefright/rtsp/ARTPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTPConnection.cpp
@@ -508,8 +508,6 @@
if (n != (ssize_t)buffer->size()) {
ALOGW("failed to send RTCP TMMBR (%s).",
n >= 0 ? "connection gone" : strerror(errno));
-
- it = mStreams.erase(it);
continue;
}
}
@@ -560,8 +558,6 @@
if (n != (ssize_t)buffer->size()) {
ALOGW("failed to send RTCP receiver report (%s).",
n >= 0 ? "connection gone" : strerror(errno));
-
- it = mStreams.erase(it);
continue;
}
@@ -621,7 +617,14 @@
} while (nbytes < 0 && errno == EINTR);
if (nbytes <= 0) {
- return -ECONNRESET;
+ ALOGW("failed to recv rtp packet. cause=%s", strerror(errno));
+ // ECONNREFUSED may happen in next recvfrom() calling if one of
+ // outgoing packet can not be delivered to remote by using sendto()
+ if (errno == ECONNREFUSED) {
+ return -ECONNREFUSED;
+ } else {
+ return -ECONNRESET;
+ }
}
buffer->setRange(0, nbytes);
@@ -665,6 +668,10 @@
pRemoteRTCPAddr, sizeSockSt);
} while (n < 0 && errno == EINTR);
+ if (n < 0) {
+ ALOGW("failed to send rtcp packet. cause=%s", strerror(errno));
+ }
+
return n;
}