Loading media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp +36 −6 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,7 @@ SoftMPEG2::SoftMPEG2( kProfileLevels, ARRAY_SIZE(kProfileLevels), kProfileLevels, ARRAY_SIZE(kProfileLevels), 320 /* width */, 240 /* height */, callbacks, 320 /* width */, 240 /* height */, callbacks, appData, component), appData, component), mCodecCtx(NULL), mMemRecords(NULL), mMemRecords(NULL), mFlushOutBuffer(NULL), mFlushOutBuffer(NULL), mOmxColorFormat(OMX_COLOR_FormatYUV420Planar), mOmxColorFormat(OMX_COLOR_FormatYUV420Planar), Loading @@ -75,6 +76,7 @@ SoftMPEG2::SoftMPEG2( mNewWidth(mWidth), mNewWidth(mWidth), mNewHeight(mHeight), mNewHeight(mHeight), mChangingResolution(false), mChangingResolution(false), mSignalledError(false), mStride(mWidth) { mStride(mWidth) { initPorts(kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); initPorts(kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); Loading @@ -82,11 +84,21 @@ SoftMPEG2::SoftMPEG2( GENERATE_FILE_NAMES(); GENERATE_FILE_NAMES(); CREATE_DUMP_FILE(mInFile); CREATE_DUMP_FILE(mInFile); CHECK_EQ(initDecoder(), (status_t)OK); if (OK != initDecoder()) { ALOGE("Failed to initialize decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } } } SoftMPEG2::~SoftMPEG2() { SoftMPEG2::~SoftMPEG2() { CHECK_EQ(deInitDecoder(), (status_t)OK); if (OK != deInitDecoder()) { ALOGE("Failed to deinit decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } } } Loading Loading @@ -204,6 +216,7 @@ status_t SoftMPEG2::resetDecoder() { setNumCores(); setNumCores(); mStride = 0; mStride = 0; mSignalledError = false; return OK; return OK; } } Loading Loading @@ -433,6 +446,7 @@ status_t SoftMPEG2::deInitDecoder() { mInitNeeded = true; mInitNeeded = true; mChangingResolution = false; mChangingResolution = false; mCodecCtx = NULL; return OK; return OK; } } Loading @@ -444,10 +458,13 @@ status_t SoftMPEG2::reInitDecoder() { ret = initDecoder(); ret = initDecoder(); if (OK != ret) { if (OK != ret) { ALOGE("Create failure"); ALOGE("Failed to initialize decoder"); deInitDecoder(); deInitDecoder(); return NO_MEMORY; notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return ret; } } mSignalledError = false; return OK; return OK; } } Loading Loading @@ -586,6 +603,9 @@ void SoftMPEG2::onPortFlushCompleted(OMX_U32 portIndex) { void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { UNUSED(portIndex); UNUSED(portIndex); if (mSignalledError) { return; } if (mOutputPortSettingsChange != NONE) { if (mOutputPortSettingsChange != NONE) { return; return; } } Loading Loading @@ -642,7 +662,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { bool portWillReset = false; bool portWillReset = false; handlePortSettingsChange(&portWillReset, mNewWidth, mNewHeight); handlePortSettingsChange(&portWillReset, mNewWidth, mNewHeight); CHECK_EQ(reInitDecoder(), (status_t)OK); if (OK != reInitDecoder()) { ALOGE("Failed to reinitialize decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } return; return; } } Loading Loading @@ -715,7 +740,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { bool portWillReset = false; bool portWillReset = false; handlePortSettingsChange(&portWillReset, s_dec_op.u4_pic_wd, s_dec_op.u4_pic_ht); handlePortSettingsChange(&portWillReset, s_dec_op.u4_pic_wd, s_dec_op.u4_pic_ht); CHECK_EQ(reInitDecoder(), (status_t)OK); if (OK != reInitDecoder()) { ALOGE("Failed to reinitialize decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } if (setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx)) { if (setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx)) { ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op); ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op); Loading media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,7 @@ private: // codec. So the codec is switching to decode the new resolution. // codec. So the codec is switching to decode the new resolution. bool mChangingResolution; bool mChangingResolution; bool mFlushNeeded; bool mFlushNeeded; bool mSignalledError; bool mWaitForI; bool mWaitForI; size_t mStride; size_t mStride; Loading Loading
media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp +36 −6 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,7 @@ SoftMPEG2::SoftMPEG2( kProfileLevels, ARRAY_SIZE(kProfileLevels), kProfileLevels, ARRAY_SIZE(kProfileLevels), 320 /* width */, 240 /* height */, callbacks, 320 /* width */, 240 /* height */, callbacks, appData, component), appData, component), mCodecCtx(NULL), mMemRecords(NULL), mMemRecords(NULL), mFlushOutBuffer(NULL), mFlushOutBuffer(NULL), mOmxColorFormat(OMX_COLOR_FormatYUV420Planar), mOmxColorFormat(OMX_COLOR_FormatYUV420Planar), Loading @@ -75,6 +76,7 @@ SoftMPEG2::SoftMPEG2( mNewWidth(mWidth), mNewWidth(mWidth), mNewHeight(mHeight), mNewHeight(mHeight), mChangingResolution(false), mChangingResolution(false), mSignalledError(false), mStride(mWidth) { mStride(mWidth) { initPorts(kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); initPorts(kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE); Loading @@ -82,11 +84,21 @@ SoftMPEG2::SoftMPEG2( GENERATE_FILE_NAMES(); GENERATE_FILE_NAMES(); CREATE_DUMP_FILE(mInFile); CREATE_DUMP_FILE(mInFile); CHECK_EQ(initDecoder(), (status_t)OK); if (OK != initDecoder()) { ALOGE("Failed to initialize decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } } } SoftMPEG2::~SoftMPEG2() { SoftMPEG2::~SoftMPEG2() { CHECK_EQ(deInitDecoder(), (status_t)OK); if (OK != deInitDecoder()) { ALOGE("Failed to deinit decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } } } Loading Loading @@ -204,6 +216,7 @@ status_t SoftMPEG2::resetDecoder() { setNumCores(); setNumCores(); mStride = 0; mStride = 0; mSignalledError = false; return OK; return OK; } } Loading Loading @@ -433,6 +446,7 @@ status_t SoftMPEG2::deInitDecoder() { mInitNeeded = true; mInitNeeded = true; mChangingResolution = false; mChangingResolution = false; mCodecCtx = NULL; return OK; return OK; } } Loading @@ -444,10 +458,13 @@ status_t SoftMPEG2::reInitDecoder() { ret = initDecoder(); ret = initDecoder(); if (OK != ret) { if (OK != ret) { ALOGE("Create failure"); ALOGE("Failed to initialize decoder"); deInitDecoder(); deInitDecoder(); return NO_MEMORY; notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return ret; } } mSignalledError = false; return OK; return OK; } } Loading Loading @@ -586,6 +603,9 @@ void SoftMPEG2::onPortFlushCompleted(OMX_U32 portIndex) { void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { UNUSED(portIndex); UNUSED(portIndex); if (mSignalledError) { return; } if (mOutputPortSettingsChange != NONE) { if (mOutputPortSettingsChange != NONE) { return; return; } } Loading Loading @@ -642,7 +662,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { bool portWillReset = false; bool portWillReset = false; handlePortSettingsChange(&portWillReset, mNewWidth, mNewHeight); handlePortSettingsChange(&portWillReset, mNewWidth, mNewHeight); CHECK_EQ(reInitDecoder(), (status_t)OK); if (OK != reInitDecoder()) { ALOGE("Failed to reinitialize decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } return; return; } } Loading Loading @@ -715,7 +740,12 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) { bool portWillReset = false; bool portWillReset = false; handlePortSettingsChange(&portWillReset, s_dec_op.u4_pic_wd, s_dec_op.u4_pic_ht); handlePortSettingsChange(&portWillReset, s_dec_op.u4_pic_wd, s_dec_op.u4_pic_ht); CHECK_EQ(reInitDecoder(), (status_t)OK); if (OK != reInitDecoder()) { ALOGE("Failed to reinitialize decoder"); notify(OMX_EventError, OMX_ErrorUnsupportedSetting, 0, NULL); mSignalledError = true; return; } if (setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx)) { if (setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx)) { ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op); ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op); Loading
media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,7 @@ private: // codec. So the codec is switching to decode the new resolution. // codec. So the codec is switching to decode the new resolution. bool mChangingResolution; bool mChangingResolution; bool mFlushNeeded; bool mFlushNeeded; bool mSignalledError; bool mWaitForI; bool mWaitForI; size_t mStride; size_t mStride; Loading