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

Commit 7de78d49 authored by Harish Mahendrakar's avatar Harish Mahendrakar Committed by Fyodor Kyslov
Browse files

C2SoftAomEnc: Fix P010 color format support

C2SoftAomEnc was advertising C2StreamPixelFormatInfo::output
instead of C2StreamPixelFormatInfo::input and because of this
color formats were not advertised correctly.

Also P010 support needs to be advertised only on those devices
that can support HAL_PIXEL_FORMAT_YCBCR_P010.

Bug: 267464137
Test: atest CtsMediaV2TestCases:CodecInfoTest

Change-Id: I7cae76299565e71e2c6d88e648fb02213fc32c79
parent 92b43c0b
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <media/stagefright/foundation/MediaDefs.h>

#include <C2Debug.h>
#include <Codec2CommonUtils.h>
#include <Codec2Mapper.h>
#include <C2PlatformSupport.h>
#include <SimpleC2Interface.h>
@@ -105,19 +106,18 @@ C2SoftAomEnc::IntfImpl::IntfImpl(const std::shared_ptr<C2ReflectorHelper>& helpe
                         .withSetter(ProfileLevelSetter)
                         .build());

    std::vector<uint32_t> pixelFormats = {HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
                                          HAL_PIXEL_FORMAT_YCBCR_420_888};
    if (isHalPixelFormatSupported((AHardwareBuffer_Format)HAL_PIXEL_FORMAT_YCBCR_P010)) {
        pixelFormats.push_back(HAL_PIXEL_FORMAT_YCBCR_P010);
    }
    addParameter(DefineParam(mPixelFormat, C2_PARAMKEY_PIXEL_FORMAT)
                         .withDefault(new C2StreamPixelFormatInfo::output(
                         .withDefault(new C2StreamPixelFormatInfo::input(
                              0u, HAL_PIXEL_FORMAT_YCBCR_420_888))
                         .withFields({C2F(mPixelFormat, value).oneOf({
                                            HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
                                            HAL_PIXEL_FORMAT_YCBCR_420_888,
                                            HAL_PIXEL_FORMAT_YCBCR_P010
                                     })
                         })
                         .withFields({C2F(mPixelFormat, value).oneOf({pixelFormats})})
                         .withSetter((Setter<decltype(*mPixelFormat)>::StrictValueWithNoDeps))
                         .build());


    addParameter(DefineParam(mRequestSync, C2_PARAMKEY_REQUEST_SYNC_FRAME)
                         .withDefault(new C2StreamRequestSyncFrameTuning::output(0u, C2_FALSE))
                         .withFields({C2F(mRequestSync, value).oneOf({C2_FALSE, C2_TRUE})})
+2 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams {
    std::shared_ptr<C2StreamColorAspectsInfo::output> getCodedColorAspects_l() const {
        return mCodedColorAspects;
    }
    std::shared_ptr<C2StreamPixelFormatInfo::output> getPixelFormat_l() const {
    std::shared_ptr<C2StreamPixelFormatInfo::input> getPixelFormat_l() const {
        return mPixelFormat;
    }
    uint32_t getSyncFramePeriod() const;
@@ -156,7 +156,7 @@ class C2SoftAomEnc::IntfImpl : public SimpleInterface<void>::BaseParams {
    std::shared_ptr<C2StreamProfileLevelInfo::output> mProfileLevel;
    std::shared_ptr<C2StreamColorAspectsInfo::input> mColorAspects;
    std::shared_ptr<C2StreamColorAspectsInfo::output> mCodedColorAspects;
    std::shared_ptr<C2StreamPixelFormatInfo::output> mPixelFormat;
    std::shared_ptr<C2StreamPixelFormatInfo::input> mPixelFormat;

};