Loading media/libstagefright/codecs/gsm/dec/SoftGSM.cpp +25 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ static void InitOMXParams(T *params) { params->nVersion.s.nStep = 0; } // Microsoft WAV GSM encoding packs two GSM frames into 65 bytes. static const int kMSGSMFrameSize = 65; SoftGSM::SoftGSM( const char *name, const OMX_CALLBACKTYPE *callbacks, Loading Loading @@ -64,7 +67,7 @@ void SoftGSM::initPorts() { def.eDir = OMX_DirInput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = sizeof(gsm_frame); def.nBufferSize = 1024 / kMSGSMFrameSize * kMSGSMFrameSize; def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainAudio; Loading Loading @@ -207,8 +210,8 @@ void SoftGSM::onQueueFilled(OMX_U32 /* portIndex */) { mSignalledError = true; } if(((inHeader->nFilledLen / 65) * 65) != inHeader->nFilledLen) { ALOGE("input buffer not multiple of 65 (%d).", inHeader->nFilledLen); if(((inHeader->nFilledLen / kMSGSMFrameSize) * kMSGSMFrameSize) != inHeader->nFilledLen) { ALOGE("input buffer not multiple of %d (%d).", kMSGSMFrameSize, inHeader->nFilledLen); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); mSignalledError = true; } Loading Loading @@ -258,6 +261,25 @@ int SoftGSM::DecodeGSM(gsm handle, return ret; } void SoftGSM::onPortFlushCompleted(OMX_U32 portIndex) { if (portIndex == 0) { gsm_destroy(mGsm); mGsm = gsm_create(); int msopt = 1; gsm_option(mGsm, GSM_OPT_WAV49, &msopt); } } void SoftGSM::onReset() { gsm_destroy(mGsm); mGsm = gsm_create(); int msopt = 1; gsm_option(mGsm, GSM_OPT_WAV49, &msopt); mSignalledError = false; } } // namespace android Loading media/libstagefright/codecs/gsm/dec/SoftGSM.h +3 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,9 @@ protected: virtual void onQueueFilled(OMX_U32 portIndex); virtual void onPortFlushCompleted(OMX_U32 portIndex); virtual void onReset(); private: enum { kNumBuffers = 4, Loading Loading
media/libstagefright/codecs/gsm/dec/SoftGSM.cpp +25 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ static void InitOMXParams(T *params) { params->nVersion.s.nStep = 0; } // Microsoft WAV GSM encoding packs two GSM frames into 65 bytes. static const int kMSGSMFrameSize = 65; SoftGSM::SoftGSM( const char *name, const OMX_CALLBACKTYPE *callbacks, Loading Loading @@ -64,7 +67,7 @@ void SoftGSM::initPorts() { def.eDir = OMX_DirInput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = sizeof(gsm_frame); def.nBufferSize = 1024 / kMSGSMFrameSize * kMSGSMFrameSize; def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainAudio; Loading Loading @@ -207,8 +210,8 @@ void SoftGSM::onQueueFilled(OMX_U32 /* portIndex */) { mSignalledError = true; } if(((inHeader->nFilledLen / 65) * 65) != inHeader->nFilledLen) { ALOGE("input buffer not multiple of 65 (%d).", inHeader->nFilledLen); if(((inHeader->nFilledLen / kMSGSMFrameSize) * kMSGSMFrameSize) != inHeader->nFilledLen) { ALOGE("input buffer not multiple of %d (%d).", kMSGSMFrameSize, inHeader->nFilledLen); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); mSignalledError = true; } Loading Loading @@ -258,6 +261,25 @@ int SoftGSM::DecodeGSM(gsm handle, return ret; } void SoftGSM::onPortFlushCompleted(OMX_U32 portIndex) { if (portIndex == 0) { gsm_destroy(mGsm); mGsm = gsm_create(); int msopt = 1; gsm_option(mGsm, GSM_OPT_WAV49, &msopt); } } void SoftGSM::onReset() { gsm_destroy(mGsm); mGsm = gsm_create(); int msopt = 1; gsm_option(mGsm, GSM_OPT_WAV49, &msopt); mSignalledError = false; } } // namespace android Loading
media/libstagefright/codecs/gsm/dec/SoftGSM.h +3 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,9 @@ protected: virtual void onQueueFilled(OMX_U32 portIndex); virtual void onPortFlushCompleted(OMX_U32 portIndex); virtual void onReset(); private: enum { kNumBuffers = 4, Loading