[Ffmpeg-devel] FFServer and RTSP

Luca Abeni lucabe72
Wed Apr 11 15:37:17 CEST 2007

Hi all,

So, I committed my two patches, and now ffserver with RTSP / RTP is 
"kind of" working. I say "kind of" because it frequently crashes. To get 
a nice crash, just start playing an RTSP url (with vlc, for example), 
then stop it, and play it again...

While searching for the cause of the crash, I found out that there are a 
lot bugs in ffserver that can cause this crash.

- First of all, rtsp_cmd_teardown() is calling close_connection(rtp_c), 
which frees rtp_c and all its buffers, and then is accessing 
rtp_c->session_id and other freed fields... :(

- Then, there are some other strange things like the 
c->rtp_ctx[stream_index]->streams[0]->priv_data field which is not 
dynamically allocated (every time that an RTSP connection is createdm 
this filed is copied from an AVStream structure that is allocated during 
the initialization of the program), but is av_free()d when the 
connection ends (this is why ffserver crashes when the second connection 
ends, I think).

Even not considering the crashes, ffserver has some other "funny 
behaviour" when streaming RTP: for example, the first two frames read 
from the file have the same PTSs and DTSs, sometimes resulting in a 
"error, non monotone timestamps 45000 >= 45000 st:1" error when trying 
to stream them (I say sometimes, because if the first PTS is 0 then the 
error does not occourr...). I think the error is due to the fact that 
the file is opened (with av_open_input_file()), but 
av_find_stream_info() is not invoked...
Is it legal to open a file for reading (av_open_input_file()), and start 
reading frames from it without performing an av_find_stream_info()?

Anyway, it seems to me that ffserver is in a very bad shape regarding 
RTSP/RTS streaming...
So I'd like to have an opinion from other people (an opinion from the 
official maintainer would be appreciated :): is there any hope in fixing 
ffserver for RTP streaming? (did it ever work, at least one time?).
Or would it be simpler to start developing a new RTP streaming 
application from scratch? I am beginning to think the second option 
would require less work... :(


More information about the ffmpeg-devel mailing list