Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a04740b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Codec2InfoBuilder: List HDR profiles only if device supports HDR...

Merge "Codec2InfoBuilder: List HDR profiles only if device supports HDR display" am: 94a233ae am: 7ebbe795 am: 94ba6a95 am: ede583f8

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2105351



Change-Id: Ib0af8daeda6deeca30616f644ae388d6cd6e4272
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b175f940 ede583f8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ cc_library_shared {
        "media_ndk_headers",
    ],

    static_libs: [
        "SurfaceFlingerProperties",
    ],

    shared_libs: [
        "android.hardware.cas.native@1.0",
        "android.hardware.drm@1.0",
+9 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <OMX_Video.h>
#include <OMX_VideoExt.h>
#include <OMX_AsString.h>
#include <SurfaceFlingerProperties.sysprop.h>

#include <android/hardware/media/omx/1.0/IOmx.h>
#include <android/hardware/media/omx/1.0/IOmxObserver.h>
@@ -159,6 +160,12 @@ bool addSupportedProfileLevels(
    // TODO: directly check this from the component interface
    supports10Bit = (supportsHdr || supportsHdr10Plus);

    // If the device doesn't support HDR display, then no codec on the device
    // can advertise support for HDR profiles.
    // Default to true to maintain backward compatibility
    auto ret = sysprop::SurfaceFlingerProperties::has_HDR_display();
    bool hasHDRDisplay = ret.has_value() ? *ret : true;

    bool added = false;

    for (C2Value::Primitive profile : profileQuery[0].values.values) {
@@ -184,8 +191,8 @@ bool addSupportedProfileLevels(
        if (mapper && mapper->mapProfile(pl.profile, &sdkProfile)
                && mapper->mapLevel(pl.level, &sdkLevel)) {
            caps->addProfileLevel((uint32_t)sdkProfile, (uint32_t)sdkLevel);
            // also list HDR profiles if component supports HDR
            if (supportsHdr) {
            // also list HDR profiles if component supports HDR and device has HDR display
            if (supportsHdr && hasHDRDisplay) {
                auto hdrMapper = C2Mapper::GetHdrProfileLevelMapper(trait.mediaType);
                if (hdrMapper && hdrMapper->mapProfile(pl.profile, &sdkProfile)) {
                    caps->addProfileLevel((uint32_t)sdkProfile, (uint32_t)sdkLevel);