[vlc-devel] Problems with using FFMPEG's "h264.c" to decode H264/RTP streams

Ross Finlayson finlayson at live.com
Tue Jul 19 04:24:29 CEST 2005

Michael (cc. "vlc-devel"),

I have recently been trying to update VLC (and the appropriate LIVE.COM 
RTSP/RTP client code) to receive and render incoming H.264 RTP streams, 
using your FFMPEG H.264 decoder ("libavcodec/h264.c").  Unfortunately I 
have run into a snag that - to be solved cleanly - may require a minor 
change to your code.

The problem is that your function "decode_nal_units()" does not like to be 
passed a buffer that contains just a single NAL unit; instead, it seems to 
want a buffer that contains all NAL units that make up an 'access unit' 
(i.e., frame).  If "decode_nal_units()" is fed just a single NAL unit, then 
- at the time that "ff_er_frame_end()" is called, "error_count" has not yet 
been decremented to zero, and so we get errors about 'concealing' data.

However, the H.264/RTP client code (in the LIVE.COM libraries and VLC) 
wants to feed the decoder one NAL unit at a time.  There are two reasons 
for this.  First, it improves resiliency to packet loss.  (If a RTP packet 
is lost, then this will cause the loss only of one NAL - not of the entire 
'access unit' (frame).)  Second, your code (quite reasonably) expects a 
"nal_size" field to precede each NAL unit in the buffer.  The cleanest 
place to prepend this size field is in VLC's RTP interface code 
("modules/demux/livedotcom.cpp"), but unfortunately this can be done only 
if this code is delivered one NAL unit at a time - not an entire 'access 
unit' at a time.

Given this, would it be possible for you to update your code so that 
"decode_nal_units()" can properly handle a buffer that contains just a 
single NAL unit?


This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

More information about the vlc-devel mailing list