Loading media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -583,15 +583,17 @@ void SoftAVCEncoder::onQueueFilled(OMX_U32 /* portIndex */) { videoInput.height = align(mHeight, 16); videoInput.pitch = align(mWidth, 16); videoInput.coding_timestamp = (inHeader->nTimeStamp + 500) / 1000; // in ms const uint8_t *inputData = NULL; if (mInputDataIsMeta) { if (inHeader->nFilledLen != 8) { ALOGE("MetaData buffer is wrong size! " "(got %u bytes, expected 8)", inHeader->nFilledLen); OMX_ERRORTYPE error = validateInputBuffer(inHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); notify(OMX_EventError, error, 0, 0); return; } const uint8_t *inputData = NULL; if (mInputDataIsMeta) { inputData = extractGraphicBuffer( mInputFrameData, (mWidth * mHeight * 3) >> 1, Loading media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -442,15 +442,16 @@ void SoftMPEG4Encoder::onQueueFilled(OMX_U32 /* portIndex */) { } if (inHeader->nFilledLen > 0) { const uint8_t *inputData = NULL; if (mInputDataIsMeta) { if (inHeader->nFilledLen != 8) { ALOGE("MetaData buffer is wrong size! " "(got %u bytes, expected 8)", inHeader->nFilledLen); OMX_ERRORTYPE error = validateInputBuffer(inHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); notify(OMX_EventError, error, 0, 0); return; } const uint8_t *inputData = NULL; if (mInputDataIsMeta) { inputData = extractGraphicBuffer( mInputFrameData, (mWidth * mHeight * 3) >> 1, Loading media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -725,6 +725,13 @@ void SoftVPXEncoder::onQueueFilled(OMX_U32 /* portIndex */) { return; } OMX_ERRORTYPE error = validateInputBuffer(inputBufferHeader); if (error != OMX_ErrorNone) { ALOGE("b/27569635"); android_errorWriteLog(0x534e4554, "27569635"); notify(OMX_EventError, error, 0, 0); return; } const uint8_t *source = inputBufferHeader->pBuffer + inputBufferHeader->nOffset; Loading @@ -740,14 +747,6 @@ void SoftVPXEncoder::onQueueFilled(OMX_U32 /* portIndex */) { return; } } else { if (inputBufferHeader->nFilledLen < frameSize) { android_errorWriteLog(0x534e4554, "27569635"); notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); return; } else if (inputBufferHeader->nFilledLen > frameSize) { ALOGW("Input buffer contains too many pixels"); } if (mColorFormat == OMX_COLOR_FormatYUV420SemiPlanar) { ConvertYUV420SemiPlanarToYUV420Planar( source, mConversionBuffer, mWidth, mHeight); Loading media/libstagefright/include/SoftVideoEncoderOMXComponent.h +2 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ protected: virtual OMX_ERRORTYPE getExtensionIndex(const char *name, OMX_INDEXTYPE *index); OMX_ERRORTYPE validateInputBuffer(const OMX_BUFFERHEADERTYPE *inputBufferHeader); enum { kInputPortIndex = 0, kOutputPortIndex = 1, Loading media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -638,4 +638,15 @@ OMX_ERRORTYPE SoftVideoEncoderOMXComponent::getExtensionIndex( return SimpleSoftOMXComponent::getExtensionIndex(name, index); } OMX_ERRORTYPE SoftVideoEncoderOMXComponent::validateInputBuffer( const OMX_BUFFERHEADERTYPE *inputBufferHeader) { size_t frameSize = mInputDataIsMeta ? 8 : mWidth * mHeight * 3 / 2; if (inputBufferHeader->nFilledLen < frameSize) { return OMX_ErrorUndefined; } else if (inputBufferHeader->nFilledLen > frameSize) { ALOGW("Input buffer contains more data than expected."); } return OMX_ErrorNone; } } // namespace android Loading
media/libstagefright/codecs/avc/enc/SoftAVCEncoder.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -583,15 +583,17 @@ void SoftAVCEncoder::onQueueFilled(OMX_U32 /* portIndex */) { videoInput.height = align(mHeight, 16); videoInput.pitch = align(mWidth, 16); videoInput.coding_timestamp = (inHeader->nTimeStamp + 500) / 1000; // in ms const uint8_t *inputData = NULL; if (mInputDataIsMeta) { if (inHeader->nFilledLen != 8) { ALOGE("MetaData buffer is wrong size! " "(got %u bytes, expected 8)", inHeader->nFilledLen); OMX_ERRORTYPE error = validateInputBuffer(inHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); notify(OMX_EventError, error, 0, 0); return; } const uint8_t *inputData = NULL; if (mInputDataIsMeta) { inputData = extractGraphicBuffer( mInputFrameData, (mWidth * mHeight * 3) >> 1, Loading
media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -442,15 +442,16 @@ void SoftMPEG4Encoder::onQueueFilled(OMX_U32 /* portIndex */) { } if (inHeader->nFilledLen > 0) { const uint8_t *inputData = NULL; if (mInputDataIsMeta) { if (inHeader->nFilledLen != 8) { ALOGE("MetaData buffer is wrong size! " "(got %u bytes, expected 8)", inHeader->nFilledLen); OMX_ERRORTYPE error = validateInputBuffer(inHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); notify(OMX_EventError, error, 0, 0); return; } const uint8_t *inputData = NULL; if (mInputDataIsMeta) { inputData = extractGraphicBuffer( mInputFrameData, (mWidth * mHeight * 3) >> 1, Loading
media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -725,6 +725,13 @@ void SoftVPXEncoder::onQueueFilled(OMX_U32 /* portIndex */) { return; } OMX_ERRORTYPE error = validateInputBuffer(inputBufferHeader); if (error != OMX_ErrorNone) { ALOGE("b/27569635"); android_errorWriteLog(0x534e4554, "27569635"); notify(OMX_EventError, error, 0, 0); return; } const uint8_t *source = inputBufferHeader->pBuffer + inputBufferHeader->nOffset; Loading @@ -740,14 +747,6 @@ void SoftVPXEncoder::onQueueFilled(OMX_U32 /* portIndex */) { return; } } else { if (inputBufferHeader->nFilledLen < frameSize) { android_errorWriteLog(0x534e4554, "27569635"); notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); return; } else if (inputBufferHeader->nFilledLen > frameSize) { ALOGW("Input buffer contains too many pixels"); } if (mColorFormat == OMX_COLOR_FormatYUV420SemiPlanar) { ConvertYUV420SemiPlanarToYUV420Planar( source, mConversionBuffer, mWidth, mHeight); Loading
media/libstagefright/include/SoftVideoEncoderOMXComponent.h +2 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ protected: virtual OMX_ERRORTYPE getExtensionIndex(const char *name, OMX_INDEXTYPE *index); OMX_ERRORTYPE validateInputBuffer(const OMX_BUFFERHEADERTYPE *inputBufferHeader); enum { kInputPortIndex = 0, kOutputPortIndex = 1, Loading
media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -638,4 +638,15 @@ OMX_ERRORTYPE SoftVideoEncoderOMXComponent::getExtensionIndex( return SimpleSoftOMXComponent::getExtensionIndex(name, index); } OMX_ERRORTYPE SoftVideoEncoderOMXComponent::validateInputBuffer( const OMX_BUFFERHEADERTYPE *inputBufferHeader) { size_t frameSize = mInputDataIsMeta ? 8 : mWidth * mHeight * 3 / 2; if (inputBufferHeader->nFilledLen < frameSize) { return OMX_ErrorUndefined; } else if (inputBufferHeader->nFilledLen > frameSize) { ALOGW("Input buffer contains more data than expected."); } return OMX_ErrorNone; } } // namespace android