[Live-devel] Bug with RTP over TCP and sending SET_PARAMETER after streaming has started

Matt Schuckmannn matt at schuckmannacres.com
Wed Jun 29 16:03:34 PDT 2011


Looks like the problem is more insidious than I thought.
The way the code starting on line 422 of RTSPServer.cpp is written it 
will always assume that the message is complete when it sees the first 
double \r\n regardless if it's RTP over UDP or TCP.
However, if the whole message comes in at once (i.e. in the same socket 
receive notification), including the content, then the whole message 
including the content will be passed on down to the proper handler method.
However if the whole message doesn't come in at one time then only the 
part received at the time the double \r\n is detected will be passed on 
to the handler method.

In the case of RTP over TCP and interleaving a SET_PARAMETER message 
with the video data already streaming the message dribbles in 1 byte at 
a time (I'm not sure why this is yet) and therefore the message gets 
passed on to the SET_PARAMETER handler method before the entire message 
is received.

So something needs to be done to keep the message parsing going in the 
case of a RTSP command with a Content-length header and I think you 
might want to look into checking whether it's OK that the whole buffer 
of received data is passed on to the RTSP handing code, if the server 
receives a large chunk of data with a  RTSP message interleaved with RTP 
data I think you maybe be assuming that all of that data is RTSP and end 
up dropping some of the RTP packet data.

I'll continue to look into this for my own edification and I'll make 
public any suggestions I have but I assume you Ross will want to come up 
with your own solution, and hopefully you'll be quicker than me.

Thanks,
Matt S.



On 6/29/2011 3:14 PM, Matt Schuckmannn wrote:
> Looks like there is a bug in RTSPClientSession::handleRequestBytes() 
> when SET_PARAMETER is sent to the server while streaming RTP over TCP 
> and after the PLAY command has been issued. The problem is the code 
> starting on or about line 422 of RTSPServer.cpp assumes that the the 
> message is complete when a double \r\n sequence is encountered. 
> However, in the case of SET_PARAMETER and GET_PARAMETER there is a 
> double \r\n between the headers and the content, so this code is 
> truncating the command.
>
> I haven't come up with a fix for this yet but I imagine that it 
> shouldn't be to hard.
> FYI if your doing normal RTP over UDP there is no problem, the answer 
> probably is to find the command handler code for that code and do the 
> same thing for the TCP case.
>
> Matt S.
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel


More information about the live-devel mailing list