Hi,

I am trying to implement decoding of H264 NAL units that are received from the 
camera (using live555 rtsp streaming). Everything works fine if received NAL 
unit is IDR (see part of the code in PS) but it does not work for SLICE NAL 
unit (nal_unit_type == 1). To decode image this NAL unit is not enough on its 
own and reference needs to be made to all the units since last IDR unit (key 
frame with nal_unit_type == 5). I do not know how to implement this.

How to combine last IDR unit with the following SLICE NAL units  to produce 
H264 frame before sending it to the decoder?

[cid:[email protected]]

Can you give me any advice or point me to the right direction? Any help is 
greatly appreciated.

Regards,
Miladin

PS.

Content of the buffer sent to the H264 decoder that gets decoded properly.

[cid:[email protected]]

unsigned char strTmp[4] = { 0, 0, 0, 1 };

// getting SPS config info
memcpy(acSPS, strTmp, 4);
memcpy(&acSPS[4], m_pcRtspStream->m_ustrSPS, m_pcRtspStream->m_iSPSLen);
nSPSLength = m_pcRtspStream->m_iSPSLen + 4;

// getting PPS config info
memcpy(acPPS, strTmp, 4);
memcpy(&acPPS[4], m_pcRtspStream->m_ustrPPS, m_pcRtspStream->m_iPPSLen);
nPPSLength = m_pcRtspStream->m_iPPSLen + 4;

//  before passing data to be decoder add SPS, PPS and 4 byte of strTmp to the 
IDR NAL unit (pcbCompressedData)
iStrTmpImageSize = nSPSLength + nPPSLength + 4 + nCompressedLength;
p = strTmpImage; // strTmpImage is empty allocated memory

memcpy(p, acSPS, nSPSLength);
p += nSPSLength;

memcpy(p, acPPS, nPPSLength);
p += nPPSLength;

memcpy(p, strTmp, 4);
p += 4;

memcpy(p, pcbCompressedData, nCompressedLength);
pHdr->nLength = iStrTmpImageSize;

pcbCompressedData = strTmpImage;
nCompressedLength = iStrTmpImageSize;

// Pass pcbCompressedData and nCompressedLength to the decoder
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to