0
votes

My work is like the following:

  1. Before streaming a video, the type, size and start address of each NAL unit is extracted using H.264 bitstream parser.

  2. During streaming, a single NAL unit is encapsulated into one RTP packet.

My question: I need to use the extracted NAL unit's information as input to a mux so this mux could determine whether an RTP packet contains a specific NAL unit type such as PPS. If so, it will steer it to a TCP tunnel else, the RTP packet will be steered to a UDP tunnel.

FYI : I'm using OEFMON which integrates Qualnet and Directshow Any help will be appreciated.

1
I am not sure why you would need to use a tcp channel for PPS. PPS is a perfectly valid nal unit and should be a part of your udp stream. Any particular reason? In any case you can find the NAL unit type from the nal header. 7 is sps and 8 is pps I think.Saibal
@Saibal Thanks for your reply. Sending PPS and SPS via TCP is important to guarantee the delivery of these units which have an important impact on the quality of the video. I need to know the NAL unit's type by parsing the RTP header not the NAL header. Any suggestions?Eñg Nåwål SbǾǿl

1 Answers

0
votes

The rtp header does not have information about the NAL type. You have to parse the RTP payload to get the nal type. The following code snippet shows the basics:

 nType = getbits(pRaw+12, 3, 5);

where pRaw is the start of the entire RTP packet, which makes pRaw + 12 the start of the RTP payload. So the function essentially reads the value defined by the 5 bits starting at offset 3 from the beginning of the RTP payload data. This is defined in RFC 6184.