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

Commit 9af4f002 authored by Ashok Bhat's avatar Ashok Bhat
Browse files

Fix in SoftAVCEncoder plugin



size of buffer_handle_t, a pointer type, was assumed to be
4 bytes. This patch uses sizeof(buffer_handle_t) instead.

In addition, replaced magic number 4 with sizeof(OMX_U32)

Change-Id: Id5a7ed805a7b8e9867d8e51655cd334a66ac2c2b
Signed-off-by: default avatarAshok Bhat <ashok.bhat@arm.com>
parent bc0c2c2d
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -819,9 +819,10 @@ void SoftAVCEncoder::onQueueFilled(OMX_U32 portIndex) {
                videoInput.coding_timestamp = (inHeader->nTimeStamp + 500) / 1000;  // in ms
                uint8_t *inputData = NULL;
                if (mStoreMetaDataInBuffers) {
                    if (inHeader->nFilledLen != 8) {
                    if (inHeader->nFilledLen != (sizeof(OMX_U32) + sizeof(buffer_handle_t))) {
                        ALOGE("MetaData buffer is wrong size! "
                                "(got %u bytes, expected 8)", inHeader->nFilledLen);
                                "(got %u bytes, expected %d)", inHeader->nFilledLen,
                                  sizeof(OMX_U32) + sizeof(buffer_handle_t));
                        mSignalledError = true;
                        notify(OMX_EventError, OMX_ErrorUndefined, 0, 0);
                        return;
@@ -985,7 +986,7 @@ uint8_t *SoftAVCEncoder::extractGrallocData(void *data, buffer_handle_t *buffer)
                kMetadataBufferTypeGrallocSource, type);
        return NULL;
    }
    buffer_handle_t imgBuffer = *(buffer_handle_t*)((uint8_t*)data + 4);
    buffer_handle_t imgBuffer = *(buffer_handle_t*)((uint8_t*)data + sizeof(OMX_U32));

    const Rect rect(mVideoWidth, mVideoHeight);
    uint8_t *img;