Loading media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -1190,6 +1190,12 @@ OMX_ERRORTYPE SoftAVC::setEncodeArgs( ps_inp_raw_buf->e_color_fmt = mIvVideoColorFormat; source = NULL; if ((inputBufferHeader != NULL) && inputBufferHeader->nFilledLen) { OMX_ERRORTYPE error = validateInputBuffer(inputBufferHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); return error; } source = inputBufferHeader->pBuffer + inputBufferHeader->nOffset; if (mInputDataIsMeta) { Loading media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -435,6 +435,14 @@ void SoftMPEG4Encoder::onQueueFilled(OMX_U32 /* portIndex */) { } if (inHeader->nFilledLen > 0) { OMX_ERRORTYPE error = validateInputBuffer(inHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); mSignalledError = true; notify(OMX_EventError, error, 0, 0); return; } const uint8_t *inputData = NULL; if (mInputDataIsMeta) { inputData = Loading media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -653,6 +653,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 @@ -668,14 +675,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 +13 −0 Original line number Diff line number Diff line Loading @@ -665,4 +665,17 @@ OMX_ERRORTYPE SoftVideoEncoderOMXComponent::getExtensionIndex( return SimpleSoftOMXComponent::getExtensionIndex(name, index); } OMX_ERRORTYPE SoftVideoEncoderOMXComponent::validateInputBuffer( const OMX_BUFFERHEADERTYPE *inputBufferHeader) { size_t frameSize = mInputDataIsMeta ? max(sizeof(VideoNativeMetadata), sizeof(VideoGrallocMetadata)) : 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/avcenc/SoftAVCEnc.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -1190,6 +1190,12 @@ OMX_ERRORTYPE SoftAVC::setEncodeArgs( ps_inp_raw_buf->e_color_fmt = mIvVideoColorFormat; source = NULL; if ((inputBufferHeader != NULL) && inputBufferHeader->nFilledLen) { OMX_ERRORTYPE error = validateInputBuffer(inputBufferHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); return error; } source = inputBufferHeader->pBuffer + inputBufferHeader->nOffset; if (mInputDataIsMeta) { Loading
media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -435,6 +435,14 @@ void SoftMPEG4Encoder::onQueueFilled(OMX_U32 /* portIndex */) { } if (inHeader->nFilledLen > 0) { OMX_ERRORTYPE error = validateInputBuffer(inHeader); if (error != OMX_ErrorNone) { ALOGE("b/69065651"); android_errorWriteLog(0x534e4554, "69065651"); mSignalledError = true; notify(OMX_EventError, error, 0, 0); return; } const uint8_t *inputData = NULL; if (mInputDataIsMeta) { inputData = Loading
media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp +7 −8 Original line number Diff line number Diff line Loading @@ -653,6 +653,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 @@ -668,14 +675,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 +13 −0 Original line number Diff line number Diff line Loading @@ -665,4 +665,17 @@ OMX_ERRORTYPE SoftVideoEncoderOMXComponent::getExtensionIndex( return SimpleSoftOMXComponent::getExtensionIndex(name, index); } OMX_ERRORTYPE SoftVideoEncoderOMXComponent::validateInputBuffer( const OMX_BUFFERHEADERTYPE *inputBufferHeader) { size_t frameSize = mInputDataIsMeta ? max(sizeof(VideoNativeMetadata), sizeof(VideoGrallocMetadata)) : 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