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

Commit 05c77f7d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/32153986']...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/32153986'] into security-aosp-tm-release.

Change-Id: I718fd5dfff56a1b0d6188257f388486382b59853
parents ea9f0920 011c760e
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -626,7 +626,13 @@ uint8_t* AMediaCodec_getInputBuffer(AMediaCodec *mData, size_t idx, size_t *out_
        if (out_size != NULL) {
            *out_size = abuf->capacity();
        }
        return abuf->data();

        // When an input buffer is provided to the application, it is essentially
        // empty. Ignore its offset as we will set it upon queueInputBuffer.
        // This actually works as expected as we do not provide visibility of
        // a potential internal offset to the client, so it is equivalent to
        // setting the offset to 0 prior to returning the buffer to the client.
        return abuf->base();
    }

    android::Vector<android::sp<android::MediaCodecBuffer> > abufs;
@@ -643,7 +649,7 @@ uint8_t* AMediaCodec_getInputBuffer(AMediaCodec *mData, size_t idx, size_t *out_
        if (out_size != NULL) {
            *out_size = abufs[idx]->capacity();
        }
        return abufs[idx]->data();
        return abufs[idx]->base();
    }
    ALOGE("couldn't get input buffers");
    return NULL;
@@ -658,8 +664,12 @@ uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec *mData, size_t idx, size_t *out
            return NULL;
        }

        // Note that we do not provide visibility of the internal offset to the
        // client, but it also does not make sense to provide visibility of the
        // buffer capacity vs the actual size.

        if (out_size != NULL) {
            *out_size = abuf->capacity();
            *out_size = abuf->size();
        }
        return abuf->data();
    }
@@ -672,7 +682,7 @@ uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec *mData, size_t idx, size_t *out
            return NULL;
        }
        if (out_size != NULL) {
            *out_size = abufs[idx]->capacity();
            *out_size = abufs[idx]->size();
        }
        return abufs[idx]->data();
    }
@@ -702,7 +712,8 @@ ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec *mData,
    requestActivityNotification(mData);
    switch (ret) {
        case OK:
            info->offset = offset;
            // the output buffer address is already offset in AMediaCodec_getOutputBuffer()
            info->offset = 0;
            info->size = size;
            info->flags = flags;
            info->presentationTimeUs = presentationTimeUs;
+13 −2
Original line number Diff line number Diff line
@@ -221,6 +221,11 @@ uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size)
 * dequeueOutputBuffer, and not yet queued.
 *
 * Available since API level 21.
 * <p>
 * At or before API level 35, the out_size returned was invalid, and instead the
 * size returned in the AMediaCodecBufferInfo struct from
 * AMediaCodec_dequeueOutputBuffer() should be used. After API
 * level 35, this API returns the correct output buffer size as well.
 */
uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21);

@@ -279,9 +284,16 @@ media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx,
#undef _off_t_compat

/**
 * Get the index of the next available buffer of processed data.
 * Get the index of the next available buffer of processed data along with the
 * metadata associated with it.
 *
 * Available since API level 21.
 * <p>
 * At or before API level 35, the offset in the AMediaCodecBufferInfo struct
 * was invalid and should be ignored; however, at the same time
 * the buffer size could only be obtained from this struct. After API
 * level 35, the offset returned in the struct is always set to 0, and the
 * buffer size can also be obtained from the AMediaCodec_getOutputBuffer() call.
 */
ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info,
        int64_t timeoutUs) __INTRODUCED_IN(21);
@@ -438,7 +450,6 @@ void AMediaCodec_releaseName(AMediaCodec*, char* name) __INTRODUCED_IN(28);
/**
 * Set an asynchronous callback for actionable AMediaCodec events.
 * When asynchronous callback is enabled, it is an error for the client to call
 * AMediaCodec_getInputBuffers(), AMediaCodec_getOutputBuffers(),
 * AMediaCodec_dequeueInputBuffer() or AMediaCodec_dequeueOutputBuffer().
 *
 * AMediaCodec_flush() behaves differently in asynchronous mode.