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

Commit 77e97c78 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

CCodec: handle default dataspace

Bug: 160727754
Test: manual
Change-Id: Ide4eb89b19761dd6c9ff680297b82bdb9c3f084f
parent 85ed8fd8
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1007,6 +1007,26 @@ void CCodec::configure(const sp<AMessage> &msg) {
            }
        }

        /*
         * Handle dataspace
         */
        int32_t usingRecorder;
        if (msg->findInt32("android._using-recorder", &usingRecorder) && usingRecorder) {
            android_dataspace dataSpace = HAL_DATASPACE_BT709;
            int32_t width, height;
            if (msg->findInt32("width", &width)
                    && msg->findInt32("height", &height)) {
                ColorAspects aspects;
                getColorAspectsFromFormat(msg, aspects);
                setDefaultCodecColorAspectsIfNeeded(aspects, width, height);
                // TODO: read dataspace / color aspect from the component
                setColorAspectsIntoFormat(aspects, const_cast<sp<AMessage> &>(msg));
                dataSpace = getDataSpaceForColorAspects(aspects, true /* mayexpand */);
            }
            msg->setInt32("android._dataspace", (int32_t)dataSpace);
            ALOGD("setting dataspace to %x", dataSpace);
        }

        int32_t subscribeToAllVendorParams;
        if (msg->findInt32("x-*", &subscribeToAllVendorParams) && subscribeToAllVendorParams) {
            if (config->subscribeToAllVendorParams(comp, C2_MAY_BLOCK) != OK) {