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

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

Snap for 5637134 from 8581d92e to qt-release

Change-Id: I6052380182af37113a547ee94d0170007a218fee
parents 3c01b961 8581d92e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -471,11 +471,11 @@ void C2SoftOpusEnc::process(const std::unique_ptr<C2Work>& work,
        uint8_t* outPtr = wView.data() + mBytesEncoded;
        int encodedBytes =
            opus_multistream_encode(mEncoder, mInputBufferPcm16,
                                    mNumSamplesPerFrame, outPtr, kMaxPayload);
                                    mNumSamplesPerFrame, outPtr, kMaxPayload - mBytesEncoded);
        ALOGV("encoded %i Opus bytes from %zu PCM bytes", encodedBytes,
              processSize);

        if (encodedBytes < 0 || encodedBytes > kMaxPayload) {
        if (encodedBytes < 0 || encodedBytes > (kMaxPayload - mBytesEncoded)) {
            ALOGE("opus_encode failed, encodedBytes : %d", encodedBytes);
            mSignalledError = true;
            work->result = C2_CORRUPTED;
+3 −1
Original line number Diff line number Diff line
@@ -47,7 +47,9 @@ struct C2SoftOpusEnc : public SimpleC2Component {
private:
    /* OPUS_FRAMESIZE_20_MS */
    const int kFrameSize = 960;
    const int kMaxPayload = 4000;
    const int kMaxSampleRate = 48000;
    const int kMinSampleRate = 8000;
    const int kMaxPayload = (4000 * kMaxSampleRate) / kMinSampleRate;
    const int kMaxNumChannels = 8;

    std::shared_ptr<IntfImpl> mIntf;
+40 −36
Original line number Diff line number Diff line
@@ -201,9 +201,10 @@ public:
     * \param colorFormat desired SDK color format for the MediaImage (if this is a flexible format,
     *        an attempt is made to simply represent the graphic view as a flexible SDK format
     *        without a memcpy)
     * \param copy whether the converter is used for copy or not
     */
    GraphicView2MediaImageConverter(
            const C2GraphicView &view, int32_t colorFormat)
            const C2GraphicView &view, int32_t colorFormat, bool copy)
        : mInitCheck(NO_INIT),
          mView(view),
          mWidth(view.width()),
@@ -255,7 +256,8 @@ public:
                }
                switch (mColorFormat) {
                    case COLOR_FormatYUV420Flexible:
                    {  // try to map directly. check if the planes are near one another
                        if (!copy) {
                            // try to map directly. check if the planes are near one another
                            const uint8_t *minPtr = mView.data()[0];
                            const uint8_t *maxPtr = mView.data()[0];
                            int32_t planeSize = 0;
@@ -270,13 +272,14 @@ public:
                                    maxPtr = mView.data()[i] + maxOffset;
                                }
                                planeSize += std::abs(plane.rowInc) * align(mHeight, 64)
                                    / plane.rowSampling / plane.colSampling * divUp(mAllocatedDepth, 8u);
                                        / plane.rowSampling / plane.colSampling
                                        * divUp(mAllocatedDepth, 8u);
                            }

                            if ((maxPtr - minPtr + 1) <= planeSize) {
                            // FIXME: this is risky as reading/writing data out of bound results in
                            //        an undefined behavior, but gralloc does assume a contiguous
                            //        mapping
                                // FIXME: this is risky as reading/writing data out of bound results
                                //        in an undefined behavior, but gralloc does assume a
                                //        contiguous mapping
                                for (uint32_t i = 0; i < layout.numPlanes; ++i) {
                                    const C2PlaneInfo &plane = layout.planes[i];
                                    mediaImage->mPlane[i].mOffset = mView.data()[i] - minPtr;
@@ -285,7 +288,8 @@ public:
                                    mediaImage->mPlane[i].mHorizSubsampling = plane.colSampling;
                                    mediaImage->mPlane[i].mVertSubsampling = plane.rowSampling;
                                }
                            mWrapped = new ABuffer(const_cast<uint8_t *>(minPtr), maxPtr - minPtr + 1);
                                mWrapped = new ABuffer(const_cast<uint8_t *>(minPtr),
                                                       maxPtr - minPtr + 1);
                                break;
                            }
                        }
@@ -503,7 +507,7 @@ sp<GraphicBlockBuffer> GraphicBlockBuffer::Allocate(
    int32_t colorFormat = COLOR_FormatYUV420Flexible;
    (void)format->findInt32("color-format", &colorFormat);

    GraphicView2MediaImageConverter converter(view, colorFormat);
    GraphicView2MediaImageConverter converter(view, colorFormat, false /* copy */);
    if (converter.initCheck() != OK) {
        ALOGD("Converter init failed: %d", converter.initCheck());
        return nullptr;
@@ -615,7 +619,7 @@ sp<ConstGraphicBlockBuffer> ConstGraphicBlockBuffer::Allocate(
    int32_t colorFormat = COLOR_FormatYUV420Flexible;
    (void)format->findInt32("color-format", &colorFormat);

    GraphicView2MediaImageConverter converter(*view, colorFormat);
    GraphicView2MediaImageConverter converter(*view, colorFormat, false /* copy */);
    if (converter.initCheck() != OK) {
        ALOGD("Converter init failed: %d", converter.initCheck());
        return nullptr;
@@ -708,7 +712,7 @@ bool ConstGraphicBlockBuffer::canCopy(const std::shared_ptr<C2Buffer> &buffer) c
    const_cast<ConstGraphicBlockBuffer *>(this)->format()->findInt32("color-format", &colorFormat);

    GraphicView2MediaImageConverter converter(
            buffer->data().graphicBlocks()[0].map().get(), colorFormat);
            buffer->data().graphicBlocks()[0].map().get(), colorFormat, true /* copy */);
    if (converter.initCheck() != OK) {
        ALOGD("ConstGraphicBlockBuffer::canCopy: converter init failed: %d", converter.initCheck());
        return false;
@@ -730,7 +734,7 @@ bool ConstGraphicBlockBuffer::copy(const std::shared_ptr<C2Buffer> &buffer) {
    format()->findInt32("color-format", &colorFormat);

    GraphicView2MediaImageConverter converter(
            buffer->data().graphicBlocks()[0].map().get(), colorFormat);
            buffer->data().graphicBlocks()[0].map().get(), colorFormat, true /* copy */);
    if (converter.initCheck() != OK) {
        ALOGD("ConstGraphicBlockBuffer::copy: converter init failed: %d", converter.initCheck());
        return false;
+4 −4
Original line number Diff line number Diff line
@@ -137,14 +137,14 @@ status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView
        int32_t dst_stride_v = img->mPlane[2].mRowInc;
        if (IsNV12(view) && IsI420(img)) {
            if (!libyuv::NV12ToI420(src_y, src_stride_y, src_u, src_stride_u, dst_y, dst_stride_y,
                                    dst_u, dst_stride_u, dst_v, dst_stride_v, view.width(),
                                    view.height())) {
                                    dst_u, dst_stride_u, dst_v, dst_stride_v, view.crop().width,
                                    view.crop().height)) {
                return OK;
            }
        } else {
            if (!libyuv::I420ToNV12(src_y, src_stride_y, src_u, src_stride_u, src_v, src_stride_v,
                                    dst_y, dst_stride_y, dst_u, dst_stride_u, view.width(),
                                    view.height())) {
                                    dst_y, dst_stride_y, dst_u, dst_stride_u, view.crop().width,
                                    view.crop().height)) {
                return OK;
            }
        }
+4 −2
Original line number Diff line number Diff line
@@ -2109,8 +2109,10 @@ void MatroskaExtractor::addTracks() {

                if (!strcmp("A_AAC", codecID)) {
                    AMediaFormat_setString(meta, AMEDIAFORMAT_KEY_MIME, MEDIA_MIMETYPE_AUDIO_AAC);
                    CHECK(codecPrivateSize >= 2);

                    if (codecPrivateSize < 2) {
                        ALOGW("Incomplete AAC Codec Info %zu byte", codecPrivateSize);
                        continue;
                    }
                    addESDSFromCodecPrivate(
                            meta, true, codecPrivate, codecPrivateSize);
                } else if (!strcmp("A_VORBIS", codecID)) {
Loading