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

Commit b86c9211 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4662252 from 7dccfdd8 to pi-release

Change-Id: Ic0880d43c9fbc27e8a4d30fdb81518abe1f8ecec
parents 0123c28a 7dccfdd8
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1309,8 +1309,8 @@ typedef enum acamera_metadata_tag {
     * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is START | PRECAPTURE     | Start AE precapture metering sequence
     * Any state (excluding LOCKED) | ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER is CANCEL| INACTIVE       | Currently active precapture metering sequence is canceled</p>
     * <p>If the camera device supports AE external flash mode (ON_EXTERNAL_FLASH is included in
     * ACAMERA_CONTROL_AE_AVAILABLE_MODES), aeState must be FLASH_REQUIRED after the camera device
     * finishes AE scan and it's too dark without flash.</p>
     * ACAMERA_CONTROL_AE_AVAILABLE_MODES), ACAMERA_CONTROL_AE_STATE must be FLASH_REQUIRED after
     * the camera device finishes AE scan and it's too dark without flash.</p>
     * <p>For the above table, the camera device may skip reporting any state changes that happen
     * without application intervention (i.e. mode switch, trigger, locking). Any state that
     * can be skipped in that manner is called a transient state.</p>
@@ -1331,6 +1331,7 @@ typedef enum acamera_metadata_tag {
     * @see ACAMERA_CONTROL_AE_LOCK
     * @see ACAMERA_CONTROL_AE_MODE
     * @see ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER
     * @see ACAMERA_CONTROL_AE_STATE
     * @see ACAMERA_CONTROL_MODE
     * @see ACAMERA_CONTROL_SCENE_MODE
     */
@@ -5500,9 +5501,11 @@ typedef enum acamera_metadata_enum_acamera_control_ae_mode {
     * for the external flash. Otherwise, this mode acts like ON.</p>
     * <p>When the external flash is turned off, AE mode should be changed to one of the
     * other available AE modes.</p>
     * <p>If the camera device supports AE external flash mode, aeState must be
     * FLASH_REQUIRED after the camera device finishes AE scan and it's too dark without
     * <p>If the camera device supports AE external flash mode, ACAMERA_CONTROL_AE_STATE must
     * be FLASH_REQUIRED after the camera device finishes AE scan and it's too dark without
     * flash.</p>
     *
     * @see ACAMERA_CONTROL_AE_STATE
     */
    ACAMERA_CONTROL_AE_MODE_ON_EXTERNAL_FLASH                        = 5,

+21 −20
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "ItemTable.h"
#include "include/ESDS.h"

#include <media/ExtractorUtils.h>
#include <media/MediaTrack.h>
#include <media/stagefright/foundation/ABitReader.h>
#include <media/stagefright/foundation/ABuffer.h>
@@ -1324,17 +1325,17 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
            if (mLastTrack == NULL)
                return ERROR_MALFORMED;

            sp<ABuffer> buffer = new ABuffer(chunk_data_size);
            if (buffer->data() == NULL) {
            auto buffer = heapbuffer<uint8_t>(chunk_data_size);
            if (buffer.get() == NULL) {
                return NO_MEMORY;
            }

            if (mDataSource->readAt(
                        data_offset, buffer->data(), chunk_data_size) < chunk_data_size) {
                        data_offset, buffer.get(), chunk_data_size) < chunk_data_size) {
                return ERROR_IO;
            }

            String8 mimeFormat((const char *)(buffer->data()), chunk_data_size);
            String8 mimeFormat((const char *)(buffer.get()), chunk_data_size);
            mLastTrack->meta.setCString(kKeyMIMEType, mimeFormat.string());

            break;
@@ -1833,15 +1834,15 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
        {
            *offset += chunk_size;

            sp<ABuffer> buffer = new ABuffer(chunk_data_size);
            auto buffer = heapbuffer<uint8_t>(chunk_data_size);

            if (buffer->data() == NULL) {
            if (buffer.get() == NULL) {
                ALOGE("b/28471206");
                return NO_MEMORY;
            }

            if (mDataSource->readAt(
                        data_offset, buffer->data(), chunk_data_size) < chunk_data_size) {
                        data_offset, buffer.get(), chunk_data_size) < chunk_data_size) {
                return ERROR_IO;
            }

@@ -1849,21 +1850,21 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return ERROR_MALFORMED;

            mLastTrack->meta.setData(
                    kKeyAVCC, kTypeAVCC, buffer->data(), chunk_data_size);
                    kKeyAVCC, kTypeAVCC, buffer.get(), chunk_data_size);

            break;
        }
        case FOURCC('h', 'v', 'c', 'C'):
        {
            sp<ABuffer> buffer = new ABuffer(chunk_data_size);
            auto buffer = heapbuffer<uint8_t>(chunk_data_size);

            if (buffer->data() == NULL) {
            if (buffer.get() == NULL) {
                ALOGE("b/28471206");
                return NO_MEMORY;
            }

            if (mDataSource->readAt(
                        data_offset, buffer->data(), chunk_data_size) < chunk_data_size) {
                        data_offset, buffer.get(), chunk_data_size) < chunk_data_size) {
                return ERROR_IO;
            }

@@ -1871,7 +1872,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return ERROR_MALFORMED;

            mLastTrack->meta.setData(
                    kKeyHVCC, kTypeHVCC, buffer->data(), chunk_data_size);
                    kKeyHVCC, kTypeHVCC, buffer.get(), chunk_data_size);

            *offset += chunk_size;
            break;
@@ -2212,13 +2213,13 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
            if (chunk_data_size < 0 || static_cast<uint64_t>(chunk_data_size) >= SIZE_MAX - 1) {
                return ERROR_MALFORMED;
            }
            sp<ABuffer> buffer = new ABuffer(chunk_data_size + 1);
            if (buffer->data() == NULL) {
            auto buffer = heapbuffer<uint8_t>(chunk_data_size);
            if (buffer.get() == NULL) {
                ALOGE("b/28471206");
                return NO_MEMORY;
            }
            if (mDataSource->readAt(
                data_offset, buffer->data(), chunk_data_size) != (ssize_t)chunk_data_size) {
                data_offset, buffer.get(), chunk_data_size) != (ssize_t)chunk_data_size) {
                return ERROR_IO;
            }
            const int kSkipBytesOfDataBox = 16;
@@ -2228,7 +2229,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {

            mFileMetaData.setData(
                kKeyAlbumArt, MetaData::TYPE_NONE,
                buffer->data() + kSkipBytesOfDataBox, chunk_data_size - kSkipBytesOfDataBox);
                buffer.get() + kSkipBytesOfDataBox, chunk_data_size - kSkipBytesOfDataBox);

            break;
        }
@@ -2626,16 +2627,16 @@ status_t MPEG4Extractor::parseQTMetaKey(off64_t offset, size_t size) {
        keySize -= 8;
        keyOffset += 8;

        sp<ABuffer> keyData = new ABuffer(keySize);
        if (keyData->data() == NULL) {
        auto keyData = heapbuffer<uint8_t>(keySize);
        if (keyData.get() == NULL) {
            return ERROR_MALFORMED;
        }
        if (mDataSource->readAt(
                keyOffset, keyData->data(), keySize) < (ssize_t) keySize) {
                keyOffset, keyData.get(), keySize) < (ssize_t) keySize) {
            return ERROR_MALFORMED;
        }

        AString key((const char *)keyData->data(), keySize);
        AString key((const char *)keyData.get(), keySize);
        mMetaKeyMap.add(i, key);

        keyOffset += keySize;
+12 −7
Original line number Diff line number Diff line
@@ -599,14 +599,19 @@ audio_source_t AAudioConvert_inputPresetToAudioSource(aaudio_input_preset_t pres
int32_t AAudioConvert_framesToBytes(int32_t numFrames,
                                    int32_t bytesPerFrame,
                                    int32_t *sizeInBytes) {
    // TODO implement more elegantly
    const int32_t maxChannels = 256; // ridiculously large
    const int32_t maxBytesPerFrame = maxChannels * sizeof(float);
    // Prevent overflow by limiting multiplicands.
    if (bytesPerFrame > maxBytesPerFrame || numFrames > (0x3FFFFFFF / maxBytesPerFrame)) {
    *sizeInBytes = 0;

    if (numFrames < 0 || bytesPerFrame < 0) {
        ALOGE("negative size, numFrames = %d, frameSize = %d", numFrames, bytesPerFrame);
        return AAUDIO_ERROR_OUT_OF_RANGE;
    }

    // Prevent numeric overflow.
    if (numFrames > (INT32_MAX / bytesPerFrame)) {
        ALOGE("size overflow, numFrames = %d, frameSize = %d", numFrames, bytesPerFrame);
        return AAUDIO_ERROR_OUT_OF_RANGE;
    }

    *sizeInBytes = numFrames * bytesPerFrame;
    return AAUDIO_OK;
}
+5 −3
Original line number Diff line number Diff line
@@ -196,9 +196,11 @@ private:

/**
 * Calculate the number of bytes and prevent numeric overflow.
 * The *sizeInBytes will be set to zero if there is an error.
 *
 * @param numFrames frame count
 * @param bytesPerFrame size of a frame in bytes
 * @param sizeInBytes total size in bytes
 * @param sizeInBytes pointer to a variable to receive total size in bytes
 * @return AAUDIO_OK or negative error, eg. AAUDIO_ERROR_OUT_OF_RANGE
 */
int32_t AAudioConvert_framesToBytes(int32_t numFrames,
+8 −8
Original line number Diff line number Diff line
@@ -337,8 +337,8 @@ bool HeifDecoderImpl::init(HeifStream* stream, HeifFrameInfo* frameInfo) {

    if (frameInfo != nullptr) {
        frameInfo->set(
                videoFrame->mDisplayWidth,
                videoFrame->mDisplayHeight,
                videoFrame->mWidth,
                videoFrame->mHeight,
                videoFrame->mRotationAngle,
                videoFrame->mBytesPerPixel,
                videoFrame->mIccSize,
@@ -415,8 +415,8 @@ bool HeifDecoderImpl::decode(HeifFrameInfo* frameInfo) {

    if (frameInfo != nullptr) {
        frameInfo->set(
                videoFrame->mDisplayWidth,
                videoFrame->mDisplayHeight,
                videoFrame->mWidth,
                videoFrame->mHeight,
                videoFrame->mRotationAngle,
                videoFrame->mBytesPerPixel,
                videoFrame->mIccSize,
@@ -435,12 +435,12 @@ bool HeifDecoderImpl::getScanline(uint8_t* dst) {
        return false;
    }
    VideoFrame* videoFrame = static_cast<VideoFrame*>(mFrameMemory->pointer());
    if (mCurScanline >= videoFrame->mDisplayHeight) {
    if (mCurScanline >= videoFrame->mHeight) {
        ALOGE("no more scanline available");
        return false;
    }
    uint8_t* src = videoFrame->getFlattenedData() + videoFrame->mRowBytes * mCurScanline++;
    memcpy(dst, src, videoFrame->mBytesPerPixel * videoFrame->mDisplayWidth);
    memcpy(dst, src, videoFrame->mBytesPerPixel * videoFrame->mWidth);
    return true;
}

@@ -452,8 +452,8 @@ size_t HeifDecoderImpl::skipScanlines(size_t count) {

    uint32_t oldScanline = mCurScanline;
    mCurScanline += count;
    if (mCurScanline > videoFrame->mDisplayHeight) {
        mCurScanline = videoFrame->mDisplayHeight;
    if (mCurScanline > videoFrame->mHeight) {
        mCurScanline = videoFrame->mHeight;
    }
    return (mCurScanline > oldScanline) ? (mCurScanline - oldScanline) : 0;
}
Loading