MCPcopy Create free account
hub / github.com/cisco/openh264 / DecodeFrame2WithCtx

Method DecodeFrame2WithCtx

codec/decoder/plus/src/welsDecoderExt.cpp:735–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735DECODING_STATE CWelsDecoder::DecodeFrame2WithCtx (PWelsDecoderContext pDecContext, const unsigned char* kpSrc,
736 const int kiSrcLen,
737 unsigned char** ppDst,
738 SBufferInfo* pDstInfo) {
739 if (pDecContext == NULL || pDecContext->pParam == NULL) {
740 if (m_pWelsTrace != NULL) {
741 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "Call DecodeFrame2 without Initialize.\n");
742 }
743 return dsInitialOptExpected;
744 }
745
746 if (pDecContext->pParam->bParseOnly) {
747 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be false for this API calling! \n");
748 pDecContext->iErrorCode |= dsInvalidArgument;
749 return dsInvalidArgument;
750 }
751 if (CheckBsBuffer (pDecContext, kiSrcLen)) {
752 if (ResetDecoder(pDecContext)) {
753 if (pDstInfo) pDstInfo->iBufferStatus = 0;
754 return dsOutOfMemory;
755 }
756 return dsErrorFree;
757 }
758 if (kiSrcLen > 0 && kpSrc != NULL) {
759#ifdef OUTPUT_BIT_STREAM
760 if (m_pFBS) {
761 WelsFwrite (kpSrc, sizeof (unsigned char), kiSrcLen, m_pFBS);
762 WelsFflush (m_pFBS);
763 }
764 if (m_pFBSSize) {
765 WelsFwrite (&kiSrcLen, sizeof (int), 1, m_pFBSSize);
766 WelsFflush (m_pFBSSize);
767 }
768#endif//OUTPUT_BIT_STREAM
769 pDecContext->bEndOfStreamFlag = false;
770 if (GetThreadCount (pDecContext) <= 0) {
771 pDecContext->uiDecodingTimeStamp = ++m_uiDecodeTimeStamp;
772 }
773 } else {
774 //For application MODE, the error detection should be added for safe.
775 //But for CONSOLE MODE, when decoding LAST AU, kiSrcLen==0 && kpSrc==NULL.
776 pDecContext->bEndOfStreamFlag = true;
777 pDecContext->bInstantDecFlag = true;
778 }
779
780 int64_t iStart, iEnd;
781 iStart = WelsTime();
782
783 if (GetThreadCount (pDecContext) <= 1) {
784 ppDst[0] = ppDst[1] = ppDst[2] = NULL;
785 }
786 pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding.
787 pDecContext->iFeedbackVclNalInAu = FEEDBACK_UNKNOWN_NAL; //initialize
788 unsigned long long uiInBsTimeStamp = pDstInfo->uiInBsTimeStamp;
789 if (GetThreadCount (pDecContext) <= 1) {
790 memset (pDstInfo, 0, sizeof (SBufferInfo));
791 }
792 pDstInfo->uiInBsTimeStamp = uiInBsTimeStamp;

Callers 1

ConstructAccessUnitFunction · 0.80

Calls 8

WelsLogFunction · 0.85
CheckBsBufferFunction · 0.85
WelsFwriteFunction · 0.85
WelsFflushFunction · 0.85
GetThreadCountFunction · 0.85
WelsTimeFunction · 0.85
WelsDecodeBsFunction · 0.85
ResetDecStatNumsFunction · 0.85

Tested by

no test coverage detected