Merge "Returning camcoder profiles for advanced codecs" into tm-qpr-dev am: 84422bf1e7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19996297

Change-Id: I3810794bd25922db76ba38ebf2bfa872998bf796
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Arun Johnson
2022-09-23 20:56:38 +00:00
committed by Automerger Merge Worker

View File

@@ -255,21 +255,21 @@ android_media_MediaProfiles_native_get_camcorder_profiles(JNIEnv *env, jobject /
jmethodID audioProfileConstructorMethodID = jmethodID audioProfileConstructorMethodID =
env->GetMethodID(audioProfileClazz, "<init>", "(IIIII)V"); env->GetMethodID(audioProfileClazz, "<init>", "(IIIII)V");
jobjectArray videoCodecs = (jobjectArray)env->NewObjectArray( jobjectArray videoCodecs = nullptr;
cp->getVideoCodecs().size(), videoProfileClazz, nullptr);
{ {
int i = 0; auto isAdvancedCodec = [](const MediaProfiles::VideoCodec *vc) -> bool {
return ((vc->getBitDepth() != 8
|| vc->getChromaSubsampling() != CHROMA_SUBSAMPLING_YUV_420
|| vc->getHdrFormat() != HDR_FORMAT_NONE));
};
std::vector<jobject> codecVector;
for (const MediaProfiles::VideoCodec *vc : cp->getVideoCodecs()) { for (const MediaProfiles::VideoCodec *vc : cp->getVideoCodecs()) {
if (isAdvancedCodec(vc) && !static_cast<bool>(advanced)) {
continue;
}
chroma_subsampling cs = vc->getChromaSubsampling(); chroma_subsampling cs = vc->getChromaSubsampling();
int bitDepth = vc->getBitDepth(); int bitDepth = vc->getBitDepth();
hdr_format hdr = vc->getHdrFormat(); hdr_format hdr = vc->getHdrFormat();
bool isAdvanced =
(bitDepth != 8 || cs != CHROMA_SUBSAMPLING_YUV_420 || hdr != HDR_FORMAT_NONE);
if (static_cast<bool>(advanced) && !isAdvanced) {
continue;
}
jobject videoCodec = env->NewObject(videoProfileClazz, jobject videoCodec = env->NewObject(videoProfileClazz,
videoProfileConstructorMethodID, videoProfileConstructorMethodID,
vc->getCodec(), vc->getCodec(),
@@ -281,10 +281,17 @@ android_media_MediaProfiles_native_get_camcorder_profiles(JNIEnv *env, jobject /
static_cast<int>(cs), static_cast<int>(cs),
bitDepth, bitDepth,
static_cast<int>(hdr)); static_cast<int>(hdr));
env->SetObjectArrayElement(videoCodecs, i++, videoCodec);
}
}
codecVector.push_back(videoCodec);
}
videoCodecs = (jobjectArray)env->NewObjectArray(codecVector.size(),
videoProfileClazz, nullptr);
int i = 0;
for (jobject codecObj : codecVector) {
env->SetObjectArrayElement(videoCodecs, i++, codecObj);
}
}
jobjectArray audioCodecs; jobjectArray audioCodecs;
if (quality >= CAMCORDER_QUALITY_TIME_LAPSE_LIST_START if (quality >= CAMCORDER_QUALITY_TIME_LAPSE_LIST_START
&& quality <= CAMCORDER_QUALITY_TIME_LAPSE_LIST_END) { && quality <= CAMCORDER_QUALITY_TIME_LAPSE_LIST_END) {