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

Commit 945fafe0 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7519874 from 84b903b0 to sc-d1-release

Change-Id: I67991223fff8a7ad1b56771e96120e77c2acef25
parents 74539817 84b903b0
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -307,8 +307,16 @@ status_t NuMediaExtractor::getFileFormat(sp<AMessage> *format) const {


    sp<MetaData> meta = mImpl->getMetaData();
    sp<MetaData> meta = mImpl->getMetaData();


    if (meta == nullptr) {
        //extractor did not publish file metadata
        return -EINVAL;
    }

    const char *mime;
    const char *mime;
    CHECK(meta->findCString(kKeyMIMEType, &mime));
    if (!meta->findCString(kKeyMIMEType, &mime)) {
        // no mime type maps to invalid
        return -EINVAL;
    }
    *format = new AMessage();
    *format = new AMessage();
    (*format)->setString("mime", mime);
    (*format)->setString("mime", mime);


@@ -354,6 +362,11 @@ status_t NuMediaExtractor::getExifOffsetSize(off64_t *offset, size_t *size) cons


    sp<MetaData> meta = mImpl->getMetaData();
    sp<MetaData> meta = mImpl->getMetaData();


    if (meta == nullptr) {
        //extractor did not publish file metadata
        return -EINVAL;
    }

    int64_t exifOffset, exifSize;
    int64_t exifOffset, exifSize;
    if (meta->findInt64(kKeyExifOffset, &exifOffset)
    if (meta->findInt64(kKeyExifOffset, &exifOffset)
     && meta->findInt64(kKeyExifSize, &exifSize)) {
     && meta->findInt64(kKeyExifSize, &exifSize)) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -5847,11 +5847,12 @@ DeviceVector AudioPolicyManager::getNewOutputDevices(const sp<SwAudioOutputDescr
        // With low-latency playing on speaker, music on WFD, when the first low-latency
        // With low-latency playing on speaker, music on WFD, when the first low-latency
        // output is stopped, getNewOutputDevices checks for a product strategy
        // output is stopped, getNewOutputDevices checks for a product strategy
        // from the list, as STRATEGY_SONIFICATION comes prior to STRATEGY_MEDIA.
        // from the list, as STRATEGY_SONIFICATION comes prior to STRATEGY_MEDIA.
        // If an ALARM or ENFORCED_AUDIBLE stream is supported by the product strategy,
        // If an ALARM, RING or ENFORCED_AUDIBLE stream is supported by the product strategy,
        // devices are returned for STRATEGY_SONIFICATION without checking whether the
        // devices are returned for STRATEGY_SONIFICATION without checking whether the
        // stream is associated to the output descriptor.
        // stream is associated to the output descriptor.
        if (doGetOutputDevicesForVoice() || outputDesc->isStrategyActive(productStrategy) ||
        if (doGetOutputDevicesForVoice() || outputDesc->isStrategyActive(productStrategy) ||
               ((hasStreamActive(AUDIO_STREAM_ALARM) ||
               ((hasStreamActive(AUDIO_STREAM_ALARM) ||
                hasStreamActive(AUDIO_STREAM_RING) ||
                hasStreamActive(AUDIO_STREAM_ENFORCED_AUDIBLE)) &&
                hasStreamActive(AUDIO_STREAM_ENFORCED_AUDIBLE)) &&
                mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc))) {
                mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc))) {
            // Retrieval of devices for voice DL is done on primary output profile, cannot
            // Retrieval of devices for voice DL is done on primary output profile, cannot
+31 −4
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@


#include "Parameters.h"
#include "Parameters.h"
#include "system/camera.h"
#include "system/camera.h"
#include <android-base/properties.h>
#include <android/hardware/ICamera.h>
#include <android/hardware/ICamera.h>
#include <media/MediaProfiles.h>
#include <media/MediaProfiles.h>
#include <media/mediarecorder.h>
#include <media/mediarecorder.h>
@@ -1247,6 +1248,7 @@ status_t Parameters::buildFastInfo(CameraDeviceBase *device) {
            }
            }
        }
        }
        fastInfo.maxZslSize = maxPrivInputSize;
        fastInfo.maxZslSize = maxPrivInputSize;
        fastInfo.usedZslSize = maxPrivInputSize;
    } else {
    } else {
        fastInfo.maxZslSize = {0, 0};
        fastInfo.maxZslSize = {0, 0};
    }
    }
@@ -2047,12 +2049,33 @@ status_t Parameters::set(const String8& paramString) {


    slowJpegMode = false;
    slowJpegMode = false;
    Size pictureSize = { pictureWidth, pictureHeight };
    Size pictureSize = { pictureWidth, pictureHeight };
    int64_t minFrameDurationNs = getJpegStreamMinFrameDurationNs(pictureSize);
    bool zslFrameRateSupported = false;
    if (previewFpsRange[1] > 1e9/minFrameDurationNs + FPS_MARGIN) {
    int64_t jpegMinFrameDurationNs = getJpegStreamMinFrameDurationNs(pictureSize);
    if (previewFpsRange[1] > 1e9/jpegMinFrameDurationNs + FPS_MARGIN) {
        slowJpegMode = true;
        slowJpegMode = true;
    }
    }
    if (isDeviceZslSupported || slowJpegMode ||
    if (isZslReprocessPresent) {
            property_get_bool("camera.disable_zsl_mode", false)) {
        unsigned int firstApiLevel =
            android::base::GetUintProperty<unsigned int>("ro.product.first_api_level", 0);
        Size chosenSize;
        if ((firstApiLevel >= __ANDROID_API_S__) &&
            !android::base::GetBoolProperty("ro.camera.enableCamera1MaxZsl", false)) {
            chosenSize = pictureSize;
        } else {
          // follow old behavior of keeping max zsl size as the input / output
          // zsl stream size
          chosenSize = fastInfo.maxZslSize;
        }
        int64_t zslMinFrameDurationNs = getZslStreamMinFrameDurationNs(chosenSize);
        if (zslMinFrameDurationNs > 0 &&
                previewFpsRange[1] <= (1e9/zslMinFrameDurationNs + FPS_MARGIN)) {
            zslFrameRateSupported = true;
            fastInfo.usedZslSize = chosenSize;
        }
    }

    if (isDeviceZslSupported || slowJpegMode || !zslFrameRateSupported ||
            android::base::GetBoolProperty("camera.disable_zsl_mode", false)) {
        allowZslMode = false;
        allowZslMode = false;
    } else {
    } else {
        allowZslMode = isZslReprocessPresent;
        allowZslMode = isZslReprocessPresent;
@@ -3056,6 +3079,10 @@ int64_t Parameters::getJpegStreamMinFrameDurationNs(Parameters::Size size) {
    return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_BLOB);
    return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_BLOB);
}
}


int64_t Parameters::getZslStreamMinFrameDurationNs(Parameters::Size size) {
    return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED);
}

int64_t Parameters::getMinFrameDurationNs(Parameters::Size size, int fmt) {
int64_t Parameters::getMinFrameDurationNs(Parameters::Size size, int fmt) {
    const int STREAM_DURATION_SIZE = 4;
    const int STREAM_DURATION_SIZE = 4;
    const int STREAM_FORMAT_OFFSET = 0;
    const int STREAM_FORMAT_OFFSET = 0;
+6 −0
Original line number Original line Diff line number Diff line
@@ -248,6 +248,7 @@ struct Parameters {
        bool useFlexibleYuv;
        bool useFlexibleYuv;
        Size maxJpegSize;
        Size maxJpegSize;
        Size maxZslSize;
        Size maxZslSize;
        Size usedZslSize;
        bool supportsPreferredConfigs;
        bool supportsPreferredConfigs;
    } fastInfo;
    } fastInfo;


@@ -426,6 +427,11 @@ private:
    // return -1 if input jpeg size cannot be found in supported size list
    // return -1 if input jpeg size cannot be found in supported size list
    int64_t getJpegStreamMinFrameDurationNs(Parameters::Size size);
    int64_t getJpegStreamMinFrameDurationNs(Parameters::Size size);


    // Helper function to get minimum frame duration for a
    // IMPLEMENTATION_DEFINED stream of size 'size'
    // return -1 if input size cannot be found in supported size list
    int64_t getZslStreamMinFrameDurationNs(Parameters::Size size);

    // Helper function to get minimum frame duration for a size/format combination
    // Helper function to get minimum frame duration for a size/format combination
    // return -1 if input size/format combination cannot be found.
    // return -1 if input size/format combination cannot be found.
    int64_t getMinFrameDurationNs(Parameters::Size size, int format);
    int64_t getMinFrameDurationNs(Parameters::Size size, int format);
+4 −4
Original line number Original line Diff line number Diff line
@@ -235,8 +235,8 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
    }
    }


    if (mInputStreamId == NO_STREAM) {
    if (mInputStreamId == NO_STREAM) {
        res = device->createInputStream(params.fastInfo.maxZslSize.width,
        res = device->createInputStream(params.fastInfo.usedZslSize.width,
            params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
            params.fastInfo.usedZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
            /*isMultiResolution*/false, &mInputStreamId);
            /*isMultiResolution*/false, &mInputStreamId);
        if (res != OK) {
        if (res != OK) {
            ALOGE("%s: Camera %d: Can't create input stream: "
            ALOGE("%s: Camera %d: Can't create input stream: "
@@ -258,8 +258,8 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
        mProducer->setName(String8("Camera2-ZslRingBufferConsumer"));
        mProducer->setName(String8("Camera2-ZslRingBufferConsumer"));
        sp<Surface> outSurface = new Surface(producer);
        sp<Surface> outSurface = new Surface(producer);


        res = device->createStream(outSurface, params.fastInfo.maxZslSize.width,
        res = device->createStream(outSurface, params.fastInfo.usedZslSize.width,
            params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
            params.fastInfo.usedZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
            HAL_DATASPACE_UNKNOWN, CAMERA_STREAM_ROTATION_0, &mZslStreamId,
            HAL_DATASPACE_UNKNOWN, CAMERA_STREAM_ROTATION_0, &mZslStreamId,
            String8(), std::unordered_set<int32_t>{ANDROID_SENSOR_PIXEL_MODE_DEFAULT});
            String8(), std::unordered_set<int32_t>{ANDROID_SENSOR_PIXEL_MODE_DEFAULT});
        if (res != OK) {
        if (res != OK) {