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

Function ExtractDidNal

test/api/encode_decode_api_test.cpp:281–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void ExtractDidNal (SFrameBSInfo* pBsInfo, int& iSrcLen, std::vector<SLostSim>* p_SLostSim, int iTarDid) {
282 unsigned char* pDst = new unsigned char[iSrcLen];
283 const unsigned char* pSrc = pBsInfo->sLayerInfo[0].pBsBuf;
284 int iDstLen = 0;
285 bool bLost;
286 SLostSim tmpSLostSim;
287 p_SLostSim->clear();
288 int iPrefix;
289 unsigned char* pSrcPtr = pBsInfo->sLayerInfo[0].pBsBuf;
290 for (int j = 0; j < pBsInfo->iLayerNum; j++) {
291 for (int k = 0; k < pBsInfo->sLayerInfo[j].iNalCount; k++) {
292 if (pSrcPtr[0] == 0 && pSrcPtr[1] == 0 && pSrcPtr[2] == 0 && pSrcPtr[3] == 1) {
293 iPrefix = 4;
294 } else if (pSrcPtr[0] == 0 && pSrcPtr[1] == 0 && pSrcPtr[2] == 1) {
295 iPrefix = 3;
296 } else {
297 iPrefix = 0;
298 }
299 tmpSLostSim.eNalType = (EWelsNalUnitType) ((* (pSrcPtr + iPrefix)) & 0x1f); // eNalUnitType
300 bLost = (ToRemainDidNal ((pSrcPtr + iPrefix + 2), tmpSLostSim.eNalType, iTarDid)) ? false : true;
301 tmpSLostSim.isLost = bLost;
302 p_SLostSim->push_back (tmpSLostSim);
303 if (!bLost) {
304 memcpy (pDst + iDstLen, pSrcPtr, pBsInfo->sLayerInfo[j].pNalLengthInByte[k]);
305 iDstLen += (pBsInfo->sLayerInfo[j].pNalLengthInByte[k]);
306 }
307 pSrcPtr += pBsInfo->sLayerInfo[j].pNalLengthInByte[k];
308 }
309 }
310 memset ((void*)pSrc, 0, iSrcLen);
311 memcpy ((void*)pSrc, pDst, iDstLen);
312 iSrcLen = iDstLen;
313 delete [] pDst;
314}
315
316int SimulateNALLoss (const unsigned char* pSrc, int& iSrcLen, std::vector<SLostSim>* p_SLostSim,
317 const char* pLossChars, bool bLossPara, int& iLossIdx, bool& bVCLLoss) {

Callers 3

TEST_FFunction · 0.85
TEST_PFunction · 0.85
TEST_FFunction · 0.85

Calls 2

ToRemainDidNalFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected