Merge "stagefright: avoid crash when histogram option is used" into main
diff --git a/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp b/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp
index bb6c1b8..f428fce 100644
--- a/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp
+++ b/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp
@@ -83,7 +83,7 @@
}
// Default scenario --- the consumer is display or GPU
- const AHardwareBuffer_Desc desc = {
+ const AHardwareBuffer_Desc consumableForDisplayOrGpu = {
.width = 320,
.height = 240,
.format = format,
@@ -98,7 +98,7 @@
};
// The consumer is a HW encoder
- const AHardwareBuffer_Desc descHwEncoder = {
+ const AHardwareBuffer_Desc consumableForHwEncoder = {
.width = 320,
.height = 240,
.format = format,
@@ -114,7 +114,7 @@
};
// The consumer is a SW encoder
- const AHardwareBuffer_Desc descSwEncoder = {
+ const AHardwareBuffer_Desc consumableForSwEncoder = {
.width = 320,
.height = 240,
.format = format,
@@ -128,9 +128,9 @@
.rfu1 = 0,
};
- return AHardwareBuffer_isSupported(&desc)
- && AHardwareBuffer_isSupported(&descHwEncoder)
- && AHardwareBuffer_isSupported(&descSwEncoder);
+ return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu)
+ && AHardwareBuffer_isSupported(&consumableForHwEncoder)
+ && AHardwareBuffer_isSupported(&consumableForSwEncoder);
}
} // namespace android
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 5444c60..18c57ca 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -2186,7 +2186,8 @@
buffer, bufferSize, nullptr /* sharedBuffer */,
AUDIO_SESSION_NONE, getpid(), audioServerAttributionSource(getpid()), flags,
TYPE_PATCH, AUDIO_PORT_HANDLE_NONE, frameCountToBeReady),
- PatchTrackBase(new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, true, true),
+ PatchTrackBase(mCblk ? new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, true, true)
+ : nullptr,
*playbackThread, timeout)
{
ALOGV("%s(%d): sampleRate %d mPeerTimeout %d.%03d sec",
@@ -2766,7 +2767,8 @@
sampleRate, format, channelMask, frameCount,
buffer, bufferSize, AUDIO_SESSION_NONE, getpid(),
audioServerAttributionSource(getpid()), flags, TYPE_PATCH),
- PatchTrackBase(new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, false, true),
+ PatchTrackBase(mCblk ? new ClientProxy(mCblk, mBuffer, frameCount, mFrameSize, false, true)
+ : nullptr,
*recordThread, timeout)
{
ALOGV("%s(%d): sampleRate %d mPeerTimeout %d.%03d sec",
diff --git a/services/audioflinger/timing/tests/mediasyncevent_tests.cpp b/services/audioflinger/timing/tests/mediasyncevent_tests.cpp
index 2922d90..8a6cf68 100644
--- a/services/audioflinger/timing/tests/mediasyncevent_tests.cpp
+++ b/services/audioflinger/timing/tests/mediasyncevent_tests.cpp
@@ -25,7 +25,8 @@
using namespace android::audioflinger;
namespace {
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wenum-constexpr-conversion"
TEST(MediaSyncEventTests, Basic) {
struct Cookie : public RefBase {};
@@ -66,5 +67,5 @@
syncEvent->cancel();
ASSERT_TRUE(syncEvent->isCancelled());
}
-
+#pragma clang diagnostic pop
} // namespace
diff --git a/services/audioflinger/timing/tests/synchronizedrecordstate_tests.cpp b/services/audioflinger/timing/tests/synchronizedrecordstate_tests.cpp
index ee5d269..e9e1edf 100644
--- a/services/audioflinger/timing/tests/synchronizedrecordstate_tests.cpp
+++ b/services/audioflinger/timing/tests/synchronizedrecordstate_tests.cpp
@@ -26,6 +26,8 @@
namespace {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wenum-constexpr-conversion"
TEST(SynchronizedRecordStateTests, Basic) {
struct Cookie : public RefBase {};
@@ -73,5 +75,5 @@
ASSERT_FALSE(triggered);
ASSERT_TRUE(syncEvent->isCancelled());
}
-
+#pragma clang diagnostic pop
}
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 42dce03..870e953 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -2462,6 +2462,11 @@
}
case ICameraService::EVENT_USB_DEVICE_ATTACHED:
case ICameraService::EVENT_USB_DEVICE_DETACHED: {
+ if (args.size() != 1) {
+ return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT,
+ "USB Device Event requires 1 argument");
+ }
+
// Notify CameraProviderManager for lazy HALs
mCameraProviderManager->notifyUsbDeviceEvent(eventId,
std::to_string(args[0]));