Loading media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp +27 −23 Original line number Diff line number Diff line Loading @@ -134,6 +134,12 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { } uint8_t *bitstream = inHeader->pBuffer + inHeader->nOffset; uint32_t *start_code = (uint32_t *)bitstream; bool volHeader = *start_code == 0xB0010000; if (volHeader) { PVCleanUpVideoDecoder(mHandle); mInitialized = false; } if (!mInitialized) { uint8_t *vol_data[1]; Loading @@ -141,7 +147,7 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { vol_data[0] = NULL; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { if ((inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) || volHeader) { vol_data[0] = bitstream; vol_size = inHeader->nFilledLen; } Loading Loading @@ -169,22 +175,27 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { PVSetPostProcType((VideoDecControls *) mHandle, 0); bool hasFrameData = false; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; } else if (volHeader) { hasFrameData = true; } mInitialized = true; if (mode == MPEG4_MODE && portSettingsChanged()) { if (mode == MPEG4_MODE && handlePortSettingsChange()) { return; } if (!hasFrameData) { continue; } } if (!mFramesConfigured) { PortInfo *port = editPortInfo(1); Loading Loading @@ -223,7 +234,9 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { return; } if (portSettingsChanged()) { // H263 doesn't have VOL header, the frame size information is in short header, i.e. the // decoder may detect size change after PVDecodeVideoFrame. if (handlePortSettingsChange()) { return; } Loading Loading @@ -269,7 +282,7 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { } } bool SoftMPEG4::portSettingsChanged() { bool SoftMPEG4::handlePortSettingsChange() { uint32_t disp_width, disp_height; PVGetVideoDimensions(mHandle, (int32 *)&disp_width, (int32 *)&disp_height); Loading @@ -282,25 +295,20 @@ bool SoftMPEG4::portSettingsChanged() { ALOGV("disp_width = %d, disp_height = %d, buf_width = %d, buf_height = %d", disp_width, disp_height, buf_width, buf_height); if (mCropWidth != disp_width || mCropHeight != disp_height) { bool cropChanged = false; if (mCropWidth != disp_width || mCropHeight != disp_height) { mCropLeft = 0; mCropTop = 0; mCropWidth = disp_width; mCropHeight = disp_height; notify(OMX_EventPortSettingsChanged, 1, OMX_IndexConfigCommonOutputCrop, NULL); cropChanged = true; } if (buf_width != mWidth || buf_height != mHeight) { mWidth = buf_width; mHeight = buf_height; updatePortDefinitions(); bool portWillReset = false; const bool fakeStride = true; SoftVideoDecoderOMXComponent::handlePortSettingsChange( &portWillReset, buf_width, buf_height, cropChanged, fakeStride); if (portWillReset) { if (mMode == MODE_H263) { PVCleanUpVideoDecoder(mHandle); Loading @@ -318,13 +326,9 @@ bool SoftMPEG4::portSettingsChanged() { } mFramesConfigured = false; notify(OMX_EventPortSettingsChanged, 1, 0, NULL); mOutputPortSettingsChange = AWAITING_DISABLED; return true; } return false; return portWillReset; } void SoftMPEG4::onPortFlushCompleted(OMX_U32 portIndex) { Loading media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ private: status_t initDecoder(); virtual void updatePortDefinitions(); bool portSettingsChanged(); bool handlePortSettingsChange(); DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG4); }; Loading media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1426,7 +1426,7 @@ PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop) video->nBitsForMBID = CalcNumBits((uint)video->nTotalMB - 1); /* otherwise calculate above */ } size = (int32)video->width * video->height; if (video->currVop->predictionType == P_VOP && size > video->videoDecControls->size) if (currVop->predictionType == P_VOP && size > video->videoDecControls->size) { status = PV_FAIL; goto return_point; Loading media/libstagefright/colorconversion/SoftwareRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { CHECK(format->findInt32("color-format", &colorFormatNew)); int32_t widthNew, heightNew; CHECK(format->findInt32("width", &widthNew)); CHECK(format->findInt32("height", &heightNew)); CHECK(format->findInt32("stride", &widthNew)); CHECK(format->findInt32("slice-height", &heightNew)); int32_t cropLeftNew, cropTopNew, cropRightNew, cropBottomNew; if (!format->findRect( Loading media/libstagefright/include/SoftVideoDecoderOMXComponent.h +2 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,8 @@ protected: virtual void updatePortDefinitions(bool updateCrop = true); void handlePortSettingsChange( bool *portWillReset, uint32_t width, uint32_t height, bool cropChanged = false); bool *portWillReset, uint32_t width, uint32_t height, bool cropChanged = false, bool fakeStride = false); void copyYV12FrameToOutputBuffer( uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV, Loading Loading
media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp +27 −23 Original line number Diff line number Diff line Loading @@ -134,6 +134,12 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { } uint8_t *bitstream = inHeader->pBuffer + inHeader->nOffset; uint32_t *start_code = (uint32_t *)bitstream; bool volHeader = *start_code == 0xB0010000; if (volHeader) { PVCleanUpVideoDecoder(mHandle); mInitialized = false; } if (!mInitialized) { uint8_t *vol_data[1]; Loading @@ -141,7 +147,7 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { vol_data[0] = NULL; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { if ((inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) || volHeader) { vol_data[0] = bitstream; vol_size = inHeader->nFilledLen; } Loading Loading @@ -169,22 +175,27 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { PVSetPostProcType((VideoDecControls *) mHandle, 0); bool hasFrameData = false; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; } else if (volHeader) { hasFrameData = true; } mInitialized = true; if (mode == MPEG4_MODE && portSettingsChanged()) { if (mode == MPEG4_MODE && handlePortSettingsChange()) { return; } if (!hasFrameData) { continue; } } if (!mFramesConfigured) { PortInfo *port = editPortInfo(1); Loading Loading @@ -223,7 +234,9 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { return; } if (portSettingsChanged()) { // H263 doesn't have VOL header, the frame size information is in short header, i.e. the // decoder may detect size change after PVDecodeVideoFrame. if (handlePortSettingsChange()) { return; } Loading Loading @@ -269,7 +282,7 @@ void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { } } bool SoftMPEG4::portSettingsChanged() { bool SoftMPEG4::handlePortSettingsChange() { uint32_t disp_width, disp_height; PVGetVideoDimensions(mHandle, (int32 *)&disp_width, (int32 *)&disp_height); Loading @@ -282,25 +295,20 @@ bool SoftMPEG4::portSettingsChanged() { ALOGV("disp_width = %d, disp_height = %d, buf_width = %d, buf_height = %d", disp_width, disp_height, buf_width, buf_height); if (mCropWidth != disp_width || mCropHeight != disp_height) { bool cropChanged = false; if (mCropWidth != disp_width || mCropHeight != disp_height) { mCropLeft = 0; mCropTop = 0; mCropWidth = disp_width; mCropHeight = disp_height; notify(OMX_EventPortSettingsChanged, 1, OMX_IndexConfigCommonOutputCrop, NULL); cropChanged = true; } if (buf_width != mWidth || buf_height != mHeight) { mWidth = buf_width; mHeight = buf_height; updatePortDefinitions(); bool portWillReset = false; const bool fakeStride = true; SoftVideoDecoderOMXComponent::handlePortSettingsChange( &portWillReset, buf_width, buf_height, cropChanged, fakeStride); if (portWillReset) { if (mMode == MODE_H263) { PVCleanUpVideoDecoder(mHandle); Loading @@ -318,13 +326,9 @@ bool SoftMPEG4::portSettingsChanged() { } mFramesConfigured = false; notify(OMX_EventPortSettingsChanged, 1, 0, NULL); mOutputPortSettingsChange = AWAITING_DISABLED; return true; } return false; return portWillReset; } void SoftMPEG4::onPortFlushCompleted(OMX_U32 portIndex) { Loading
media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.h +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ private: status_t initDecoder(); virtual void updatePortDefinitions(); bool portSettingsChanged(); bool handlePortSettingsChange(); DISALLOW_EVIL_CONSTRUCTORS(SoftMPEG4); }; Loading
media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1426,7 +1426,7 @@ PV_STATUS DecodeShortHeader(VideoDecData *video, Vop *currVop) video->nBitsForMBID = CalcNumBits((uint)video->nTotalMB - 1); /* otherwise calculate above */ } size = (int32)video->width * video->height; if (video->currVop->predictionType == P_VOP && size > video->videoDecControls->size) if (currVop->predictionType == P_VOP && size > video->videoDecControls->size) { status = PV_FAIL; goto return_point; Loading
media/libstagefright/colorconversion/SoftwareRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) { CHECK(format->findInt32("color-format", &colorFormatNew)); int32_t widthNew, heightNew; CHECK(format->findInt32("width", &widthNew)); CHECK(format->findInt32("height", &heightNew)); CHECK(format->findInt32("stride", &widthNew)); CHECK(format->findInt32("slice-height", &heightNew)); int32_t cropLeftNew, cropTopNew, cropRightNew, cropBottomNew; if (!format->findRect( Loading
media/libstagefright/include/SoftVideoDecoderOMXComponent.h +2 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,8 @@ protected: virtual void updatePortDefinitions(bool updateCrop = true); void handlePortSettingsChange( bool *portWillReset, uint32_t width, uint32_t height, bool cropChanged = false); bool *portWillReset, uint32_t width, uint32_t height, bool cropChanged = false, bool fakeStride = false); void copyYV12FrameToOutputBuffer( uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV, Loading