Merge "C2: channel mask can be input to encoder" into udc-dev
diff --git a/camera/CameraSessionStats.cpp b/camera/CameraSessionStats.cpp
index 26c612a..3954db5 100644
--- a/camera/CameraSessionStats.cpp
+++ b/camera/CameraSessionStats.cpp
@@ -278,7 +278,8 @@
mRequestCount(0),
mResultErrorCount(0),
mDeviceError(false),
- mVideoStabilizationMode(-1) {}
+ mVideoStabilizationMode(-1),
+ mSessionIndex(0) {}
CameraSessionStats::CameraSessionStats(const String16& cameraId,
int facing, int newCameraState, const String16& clientName,
@@ -297,7 +298,8 @@
mRequestCount(0),
mResultErrorCount(0),
mDeviceError(0),
- mVideoStabilizationMode(-1) {}
+ mVideoStabilizationMode(-1),
+ mSessionIndex(0) {}
status_t CameraSessionStats::readFromParcel(const android::Parcel* parcel) {
if (parcel == NULL) {
@@ -409,6 +411,12 @@
return err;
}
+ int32_t sessionIdx;
+ if ((err = parcel->readInt32(&sessionIdx)) != OK) {
+ ALOGE("%s: Failed to read session index from parcel", __FUNCTION__);
+ return err;
+ }
+
mCameraId = id;
mFacing = facing;
mNewCameraState = newCameraState;
@@ -426,6 +434,7 @@
mStreamStats = std::move(streamStats);
mUserTag = userTag;
mVideoStabilizationMode = videoStabilizationMode;
+ mSessionIndex = sessionIdx;
return OK;
}
@@ -523,6 +532,11 @@
return err;
}
+ if ((err = parcel->writeInt32(mSessionIndex)) != OK) {
+ ALOGE("%s: Failed to write session index!", __FUNCTION__);
+ return err;
+ }
+
return OK;
}
diff --git a/camera/include/camera/CameraSessionStats.h b/camera/include/camera/CameraSessionStats.h
index 091a7ff..895449c 100644
--- a/camera/include/camera/CameraSessionStats.h
+++ b/camera/include/camera/CameraSessionStats.h
@@ -158,6 +158,7 @@
std::vector<CameraStreamStats> mStreamStats;
String16 mUserTag;
int mVideoStabilizationMode;
+ int mSessionIndex;
// Constructors
CameraSessionStats();
diff --git a/media/codec2/hal/client/client.cpp b/media/codec2/hal/client/client.cpp
index 829a179..97c0806 100644
--- a/media/codec2/hal/client/client.cpp
+++ b/media/codec2/hal/client/client.cpp
@@ -610,16 +610,9 @@
// Codec2Client
Codec2Client::Codec2Client(sp<Base> const& base,
+ sp<IConfigurable> const& configurable,
size_t serviceIndex)
- : Configurable{
- [base]() -> sp<IConfigurable> {
- Return<sp<IConfigurable>> transResult =
- base->getConfigurable();
- return transResult.isOk() ?
- static_cast<sp<IConfigurable>>(transResult) :
- nullptr;
- }()
- },
+ : Configurable{configurable},
mBase1_0{base},
mBase1_1{Base1_1::castFrom(base)},
mBase1_2{Base1_2::castFrom(base)},
@@ -1003,7 +996,11 @@
CHECK(baseStore) << "Codec2 service \"" << name << "\""
" inaccessible for unknown reasons.";
LOG(VERBOSE) << "Client to Codec2 service \"" << name << "\" created";
- return std::make_shared<Codec2Client>(baseStore, index);
+ Return<sp<IConfigurable>> transResult = baseStore->getConfigurable();
+ CHECK(transResult.isOk()) << "Codec2 service \"" << name << "\""
+ "does not have IConfigurable.";
+ sp<IConfigurable> configurable = static_cast<sp<IConfigurable>>(transResult);
+ return std::make_shared<Codec2Client>(baseStore, configurable, index);
}
c2_status_t Codec2Client::ForAllServices(
diff --git a/media/codec2/hal/client/include/codec2/hidl/client.h b/media/codec2/hal/client/include/codec2/hidl/client.h
index efbf179..5267394 100644
--- a/media/codec2/hal/client/include/codec2/hidl/client.h
+++ b/media/codec2/hal/client/include/codec2/hidl/client.h
@@ -146,6 +146,8 @@
typedef ::android::hardware::media::c2::V1_2::IComponentStore Base1_2;
typedef Base1_0 Base;
+ typedef ::android::hardware::media::c2::V1_0::IConfigurable IConfigurable;
+
struct Listener;
typedef Codec2ConfigurableClient Configurable;
@@ -230,8 +232,11 @@
static std::shared_ptr<InputSurface> CreateInputSurface(
char const* serviceName = nullptr);
- // base cannot be null.
- Codec2Client(sp<Base> const& base, size_t serviceIndex);
+ // base and/or configurable cannot be null.
+ Codec2Client(
+ sp<Base> const& base,
+ sp<IConfigurable> const& configurable,
+ size_t serviceIndex);
protected:
sp<Base1_0> mBase1_0;
diff --git a/media/codec2/hal/plugin/samples/SampleFilterPlugin.cpp b/media/codec2/hal/plugin/samples/SampleFilterPlugin.cpp
index c77eb22..b5383ad 100644
--- a/media/codec2/hal/plugin/samples/SampleFilterPlugin.cpp
+++ b/media/codec2/hal/plugin/samples/SampleFilterPlugin.cpp
@@ -710,10 +710,6 @@
layerSettings.source.buffer.fence = Fence::NO_FENCE;
layerSettings.source.buffer.textureName = textureName;
layerSettings.source.buffer.usePremultipliedAlpha = false;
- layerSettings.source.buffer.isY410BT2020 =
- (layerSettings.sourceDataspace == ui::Dataspace::BT2020_ITU_PQ ||
- layerSettings.sourceDataspace == ui::Dataspace::BT2020_ITU_HLG) &&
- format == HAL_PIXEL_FORMAT_RGBA_1010102;
layerSettings.source.buffer.maxMasteringLuminance =
(hdrStaticInfo && *hdrStaticInfo &&
hdrStaticInfo->mastering.maxLuminance > 0 &&
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index da33b0d..1c86ba9 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -1801,8 +1801,6 @@
output->buffers->flushStash();
}
}
- // reset the frames that are being tracked for onFrameRendered callbacks
- mTrackedFrames.clear();
}
void CCodecBufferChannel::onWorkDone(
@@ -2113,7 +2111,10 @@
outBuffer->meta()->setInt32("flags", BUFFER_FLAG_CODEC_CONFIG);
ALOGV("[%s] onWorkDone: csd index = %zu [%p]", mName, index, outBuffer.get());
- output.unlock();
+ // TRICKY: we want popped buffers reported in order, so sending
+ // the callback while holding the lock here. This assumes that
+ // onOutputBufferAvailable() does not block. onOutputBufferAvailable()
+ // callbacks are always sent with the Output lock held.
mCallback->onOutputBufferAvailable(index, outBuffer);
} else {
ALOGD("[%s] onWorkDone: unable to register csd", mName);
@@ -2203,7 +2204,10 @@
case OutputBuffers::DISCARD:
break;
case OutputBuffers::NOTIFY_CLIENT:
- output.unlock();
+ // TRICKY: we want popped buffers reported in order, so sending
+ // the callback while holding the lock here. This assumes that
+ // onOutputBufferAvailable() does not block. onOutputBufferAvailable()
+ // callbacks are always sent with the Output lock held.
mCallback->onOutputBufferAvailable(index, outBuffer);
break;
case OutputBuffers::REALLOCATE:
diff --git a/media/libstagefright/FrameCaptureLayer.cpp b/media/libstagefright/FrameCaptureLayer.cpp
index d2cfd41..4e71943 100644
--- a/media/libstagefright/FrameCaptureLayer.cpp
+++ b/media/libstagefright/FrameCaptureLayer.cpp
@@ -64,14 +64,6 @@
return updatedDataspace;
}
-bool isHdrY410(const BufferItem &bi) {
- ui::Dataspace dataspace = translateDataspace(static_cast<ui::Dataspace>(bi.mDataSpace));
- // pixel format is HDR Y410 masquerading as RGBA_1010102
- return ((dataspace == ui::Dataspace::BT2020_ITU_PQ ||
- dataspace == ui::Dataspace::BT2020_ITU_HLG) &&
- bi.mGraphicBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102);
-}
-
struct FrameCaptureLayer::BufferLayer : public FrameCaptureProcessor::Layer {
BufferLayer(const BufferItem &bi) : mBufferItem(bi) {}
void getLayerSettings(
@@ -95,7 +87,6 @@
layerSettings->source.buffer.fence = mBufferItem.mFence;
layerSettings->source.buffer.textureName = textureName;
layerSettings->source.buffer.usePremultipliedAlpha = false;
- layerSettings->source.buffer.isY410BT2020 = isHdrY410(mBufferItem);
bool hasSmpte2086 = mBufferItem.mHdrMetadata.validTypes & HdrMetadata::SMPTE2086;
bool hasCta861_3 = mBufferItem.mHdrMetadata.validTypes & HdrMetadata::CTA861_3;
layerSettings->source.buffer.maxMasteringLuminance = hasSmpte2086
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 8d0c648..64de99a 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -9985,6 +9985,9 @@
audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE;
audio_io_handle_t io = mId;
+ AttributionSourceState adjAttributionSource = AudioFlinger::checkAttributionSourcePackage(
+ client.attributionSource);
+
if (isOutput()) {
audio_config_t config = AUDIO_CONFIG_INITIALIZER;
config.sample_rate = mSampleRate;
@@ -10000,7 +10003,7 @@
ret = AudioSystem::getOutputForAttr(&mAttr, &io,
mSessionId,
&stream,
- client.attributionSource,
+ adjAttributionSource,
&config,
flags,
&deviceId,
@@ -10019,7 +10022,7 @@
ret = AudioSystem::getInputForAttr(&mAttr, &io,
RECORD_RIID_INVALID,
mSessionId,
- client.attributionSource,
+ adjAttributionSource,
&config,
AUDIO_INPUT_FLAG_MMAP_NOIRQ,
&deviceId,
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index ab1a050..f093e68 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -4373,6 +4373,11 @@
ALOGE("%s the requested device is currently unavailable", __func__);
return BAD_VALUE;
}
+ if (!audio_is_usb_out_device(deviceDescriptor->type())) {
+ ALOGE("%s the requested device(type=%#x) is not usb device", __func__,
+ deviceDescriptor->type());
+ return BAD_VALUE;
+ }
for (const auto& hwModule : mHwModules) {
for (const auto& curProfile : hwModule->getOutputProfiles()) {
if (curProfile->supportsDevice(deviceDescriptor)) {
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index bc3c199..9367949 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -1843,14 +1843,12 @@
void AudioPolicyService::SensorPrivacyPolicy::registerSelf() {
SensorPrivacyManager spm;
mSensorPrivacyEnabled = spm.isSensorPrivacyEnabled();
- (void)spm.addToggleSensorPrivacyListener(this);
spm.addSensorPrivacyListener(this);
}
void AudioPolicyService::SensorPrivacyPolicy::unregisterSelf() {
SensorPrivacyManager spm;
spm.removeSensorPrivacyListener(this);
- spm.removeToggleSensorPrivacyListener(this);
}
bool AudioPolicyService::SensorPrivacyPolicy::isSensorPrivacyEnabled() {
@@ -1919,6 +1917,7 @@
// since it controls the mic permission for legacy apps.
mAppOpsManager.startWatchingMode(mAppOp, VALUE_OR_FATAL(aidl2legacy_string_view_String16(
mAttributionSource.packageName.value_or(""))),
+ AppOpsManager::WATCH_FOREGROUND_CHANGES,
mOpCallback);
}
diff --git a/services/camera/libcameraservice/api2/JpegRCompositeStream.cpp b/services/camera/libcameraservice/api2/JpegRCompositeStream.cpp
index 8223371..6588470 100644
--- a/services/camera/libcameraservice/api2/JpegRCompositeStream.cpp
+++ b/services/camera/libcameraservice/api2/JpegRCompositeStream.cpp
@@ -658,6 +658,13 @@
return res;
}
+ if ((res = native_window_set_usage(mOutputSurface.get(),
+ GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)) != OK) {
+ ALOGE("%s: Unable to configure stream buffer usage for stream %d", __FUNCTION__,
+ mP010StreamId);
+ return res;
+ }
+
int maxProducerBuffers;
ANativeWindow *anw = mP010Surface.get();
if ((res = anw->query(anw, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &maxProducerBuffers)) != OK) {
diff --git a/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp b/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp
index 4225366..af5f3ee 100644
--- a/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp
+++ b/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp
@@ -53,6 +53,7 @@
mSessionStats.mNewCameraState = CameraSessionStats::CAMERA_STATE_CLOSED;
mSessionStats.mLatencyMs = latencyMs;
mSessionStats.mDeviceError = deviceError;
+ mSessionStats.mSessionIndex = 0;
updateProxyDeviceState(proxyBinder);
}
@@ -74,6 +75,7 @@
mSessionStats.mNewCameraState = CameraSessionStats::CAMERA_STATE_ACTIVE;
mSessionStats.mMaxPreviewFps = maxPreviewFps;
+ mSessionStats.mSessionIndex++;
updateProxyDeviceState(proxyBinder);
// Reset mCreationDuration to -1 to distinguish between 1st session
diff --git a/services/tuner/TunerService.cpp b/services/tuner/TunerService.cpp
index e5bcf1f..9a1e8bb 100644
--- a/services/tuner/TunerService.cpp
+++ b/services/tuner/TunerService.cpp
@@ -100,8 +100,11 @@
if (fallBackToOpenDemux) {
auto status = mTuner->openDemux(&ids, &demux);
- return ::ndk::ScopedAStatus::fromServiceSpecificError(
- static_cast<int32_t>(Result::UNAVAILABLE));
+ if (status.isOk()) {
+ *_aidl_return = ::ndk::SharedRefBase::make<TunerDemux>(demux, ids[0],
+ this->ref<TunerService>());
+ }
+ return status;
} else {
int id = TunerHelper::getResourceIdFromHandle(in_demuxHandle, DEMUX);
auto status = mTuner->openDemuxById(id, &demux);