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

Commit c50928e2 authored by Jim Shargo's avatar Jim Shargo
Browse files

Camera3StreamSplitter: Split out a refactorable file

Doing this so that I can easily flag guard the splitter and A/B test the
different implementations.

BYPASS_IGBP_IGBC_API_REASON=warren buffers

Bug: 340933206
Flag: com.android.graphics.libgui.flags.wb_stream_splitter
Test: atest cameraservice_test
Change-Id: Ie6769b1b2fba6d63fb054c815d19e2d78ea853e6
parent aa12b679
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ cc_defaults {
        "libcamera_metadata",
        "libfmq",
        "libgui",
        "libguiflags",
        "libhardware",
        "libhidlbase",
        "libimage_io",
@@ -169,6 +170,7 @@ cc_library {
        "device3/Camera3OutputStreamInterface.cpp",
        "device3/Camera3OutputUtils.cpp",
        "device3/Camera3DeviceInjectionMethods.cpp",
        "device3/deprecated/DeprecatedCamera3StreamSplitter.cpp",
        "device3/UHRCropAndMeteringRegionMapper.cpp",
        "device3/PreviewFrameSpacer.cpp",
        "device3/hidl/HidlCamera3Device.cpp",
+11 −1
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#define ATRACE_TAG ATRACE_TAG_CAMERA
//#define LOG_NDEBUG 0

#include "Flags.h"

#include "Camera3SharedOutputStream.h"

namespace android {
@@ -59,7 +61,11 @@ Camera3SharedOutputStream::~Camera3SharedOutputStream() {
status_t Camera3SharedOutputStream::connectStreamSplitterLocked() {
    status_t res = OK;

    mStreamSplitter = new Camera3StreamSplitter(mUseHalBufManager);
#if USE_NEW_STREAM_SPLITTER
    mStreamSplitter = sp<Camera3StreamSplitter>::make(mUseHalBufManager);
#else
    mStreamSplitter = sp<DeprecatedCamera3StreamSplitter>::make(mUseHalBufManager);
#endif  // USE_NEW_STREAM_SPLITTER

    uint64_t usage = 0;
    getEndpointUsage(&usage);
@@ -90,7 +96,11 @@ status_t Camera3SharedOutputStream::attachBufferToSplitterLocked(
    // Attach the buffer to the splitter output queues. This could block if
    // the output queue doesn't have any empty slot. So unlock during the course
    // of attachBufferToOutputs.
#if USE_NEW_STREAM_SPLITTER
    sp<Camera3StreamSplitter> splitter = mStreamSplitter;
#else
    sp<DeprecatedCamera3StreamSplitter> splitter = mStreamSplitter;
#endif  // USE_NEW_STREAM_SPLITTER
    mLock.unlock();
    res = splitter->attachBufferToOutputs(anb, surface_ids);
    mLock.lock();
+13 −2
Original line number Diff line number Diff line
@@ -18,9 +18,17 @@
#define ANDROID_SERVERS_CAMERA3_SHARED_OUTPUT_STREAM_H

#include <array>
#include "Camera3StreamSplitter.h"

#include "Flags.h"

#include "Camera3OutputStream.h"

#if USE_NEW_STREAM_SPLITTER
#include "Camera3StreamSplitter.h"
#else
#include "deprecated/DeprecatedCamera3StreamSplitter.h"
#endif  // USE_NEW_STREAM_SPLITTER

namespace android {

namespace camera3 {
@@ -106,8 +114,11 @@ private:
     * The Camera3StreamSplitter object this stream uses for stream
     * sharing.
     */
#if USE_NEW_STREAM_SPLITTER
    sp<Camera3StreamSplitter> mStreamSplitter;

#else
    sp<DeprecatedCamera3StreamSplitter> mStreamSplitter;
#endif  // USE_NEW_STREAM_SPLITTER
    /**
     * Initialize stream splitter.
     */
+27 −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 <com_android_graphics_libgui_flags.h>

#ifndef USE_NEW_STREAM_SPLITTER

#define USE_NEW_STREAM_SPLITTER                              \
    COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_STREAM_SPLITTER) && \
            COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)

#endif  // USE_NEW_STREAM_SPLITTER
+820 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading