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

Commit 98a228e2 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13070131 from b13f4395 to 25Q2-release

Change-Id: I8cc0c8e668e1c42d580a75633d2d3bf419d9f369
parents e4e9e8c4 b13f4395
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ cc_library {
    defaults: [
        "libcodec2_soft-defaults",
        "libcodec2_soft_sanitize_all-defaults",
        "libcodec2_soft_sanitize_cfi-defaults",
    ],

    // coordinated with frameworks/av/media/codec2/components/gav1/Android.bp
@@ -29,6 +30,7 @@ cc_library {
    defaults: [
        "libcodec2_soft-defaults",
        "libcodec2_soft_sanitize_all-defaults",
        "libcodec2_soft_sanitize_cfi-defaults",
    ],

    static_libs: ["libaom"],
+11 −2
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ const char* MEDIA_MIMETYPE_VIDEO_APV = "video/apv";

#define MAX_NUM_FRMS (1)  // supports only 1-frame output
#define FRM_IDX (0)       // supports only 1-frame output
#define MAX_SUPPORTED_WIDTH (4096)
#define MAX_SUPPORTED_HEIGHT (4096)
// check generic frame or not
#define IS_NON_AUX_FRM(frm)                              \
    (((frm)->pbu_type == OAPV_PBU_TYPE_PRIMARY_FRAME) || \
@@ -76,8 +78,8 @@ class C2SoftApvDec::IntfImpl : public SimpleInterface<void>::BaseParams {
        addParameter(DefineParam(mSize, C2_PARAMKEY_PICTURE_SIZE)
                             .withDefault(new C2StreamPictureSizeInfo::output(0u, 320, 240))
                             .withFields({
                                     C2F(mSize, width).inRange(2, 4096),
                                     C2F(mSize, height).inRange(2, 4096),
                                     C2F(mSize, width).inRange(2, MAX_SUPPORTED_WIDTH),
                                     C2F(mSize, height).inRange(2, MAX_SUPPORTED_HEIGHT),
                             })
                             .withSetter(SizeSetter)
                             .build());
@@ -945,6 +947,7 @@ void C2SoftApvDec::process(const std::unique_ptr<C2Work>& work,

        if (OAPV_FAILED(oapvd_info(bitb.addr, bitb.ssize, &aui))) {
            ALOGE("cannot get information from bitstream");
            work->result = C2_CORRUPTED;
            return;
        }

@@ -965,6 +968,12 @@ void C2SoftApvDec::process(const std::unique_ptr<C2Work>& work,
                mHeight = finfo->h;
            }

            if (mWidth > MAX_SUPPORTED_WIDTH || mHeight > MAX_SUPPORTED_HEIGHT) {
                ALOGE("Stream resolution of %dx%d is not supported.", mWidth, mHeight);
                work->result = C2_CORRUPTED;
                return;
            }

            if (frm->imgb != NULL && (frm->imgb->w[0] != finfo->w || frm->imgb->h[0] != finfo->h)) {
                frm->imgb->release(frm->imgb);
                frm->imgb = NULL;
+16 −2
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ struct C2Config {

struct C2PlatformConfig {
    enum encoding_quality_level_t : uint32_t; ///< encoding quality level
    enum resource_id_t : uint32_t;          ///< resource IDs defined by the platform
    enum tunnel_peek_mode_t: uint32_t;      ///< tunnel peek mode
};

@@ -1290,7 +1291,10 @@ C2ENUM(C2Config::resource_kind_t, uint32_t,
 * They represent any physical or abstract entities of limited availability
 * that is required for a component instance to execute and process work.
 *
 * Each defined resource has an id.
 * Each defined resource has an id. In general, the id is defined by the vendor,
 * but the platform also defines a limited set of IDs. Vendor IDs SHALL start
 * from C2PlatformConfig::resource_id_t::VENDOR_START.
 *
 * The use of a resource is specified by the amount and the kind (e.g. whether the amount
 * of resources is required for each frame processed, or whether they are required
 * regardless of the processing rate (const amount)).
@@ -1306,7 +1310,7 @@ struct C2SystemResourceStruct {
                           uint64_t amount_)
        : id(id_), kind(kind_), amount(amount_) { }
    C2SystemResourceStruct() : C2SystemResourceStruct(0, CONST, 0) {}
    uint32_t id;
    uint32_t id;            ///< resource ID (see C2PlatformConfig::resource_id_t)
    C2Config::resource_kind_t kind;
    uint64_t amount;

@@ -2490,6 +2494,16 @@ typedef C2GlobalParam<C2Setting, C2SimpleValueStruct<C2Config::platform_feature_
        C2PlatformFeaturesSetting;
constexpr char C2_PARAMKEY_PLATFORM_FEATURES[] = "api.platform-features";

/**
 * Resource IDs
 */
enum C2PlatformConfig::resource_id_t : uint32_t {
    DMABUF_MEMORY = 16,  ///< memory allocated from a platform allocator (dmabuf or gralloc)

    /// vendor defined resource IDs start from here
    VENDOR_START = 0x1000,
};

/**
 * This structure describes the preferred ion allocation parameters for a given memory usage.
 */
+3 −0
Original line number Diff line number Diff line
@@ -161,8 +161,10 @@ cc_library {
        "Configurable.cpp",
        "InputBufferManager.cpp",
        "ParamTypes.cpp",
        "inputsurface/FrameDropper.cpp",
        "inputsurface/InputSurface.cpp",
        "inputsurface/InputSurfaceConnection.cpp",
        "inputsurface/InputSurfaceSource.cpp",
    ],

    header_libs: [
@@ -186,6 +188,7 @@ cc_library {
        "libmediandk",
        "libstagefright_aidl_bufferpool2",
        "libstagefright_bufferpool@2.0.1",
        "libstagefright_foundation",
        "libui",
        "libutils",
    ],
+57 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <utils/Errors.h>

#include <media/stagefright/foundation/ABase.h>

#include <C2.h>

namespace aidl::android::hardware::media::c2::implementation {

/**
 * The class decides whether to drop a frame or not for InputSurface and
 * InputSurfaceConnection.
 */
struct FrameDropper {
    FrameDropper();

    ~FrameDropper();

    /**
     * Sets max frame rate, which is based on for deciding frame drop.
     *
     * @param[in] maxFrameRate  negative value means there is no drop
     *                          zero value is ignored
     */
    void setMaxFrameRate(float maxFrameRate);

    /** Returns false if max frame rate has not been set via setMaxFrameRate. */
    bool shouldDrop(int64_t timeUs);

    /** Returns true if all frame drop logic should be disabled. */
    bool disabled() { return (mMinIntervalUs == -1ll); }

private:
    int64_t mDesiredMinTimeUs;
    int64_t mMinIntervalUs;

    DISALLOW_EVIL_CONSTRUCTORS(FrameDropper);
};

}  // namespace aidl::android::hardware::media::c2::implementation
Loading