Wednesday, March 24, 2010

VLC MMS start delay (keep-alive) patch

As noted in the post iPhone HTTP Live Streaming - Between a rock (Microsoft) and a Hard Place (Apple) I had occasion to use VLC to stream an MMSH stream.  It seemed to delay for a few minutes before starting to play the stream and then would play fine.

This problem has been noted for a while with some MMS streams, particular in this thread:
http://forum.videolan.org/viewtopic.php?f=14&t=45844&p=237757
and this bug report:
http://trac.videolan.org/vlc/ticket/2533


Looking through the thread above I noticed that "carver" had done some TCP sniffing and posted the results.  It looked to me like VLC was wanting to use HTTP 1.0 and the server was replying as if it supported HTTP 1.1.  The server was including Content-Length and keep-alive headers which are only supported by HTTP 1.1.  This is really a bug in the server, but it's fixable in VLC by making VLC support enough (keep-alive, content-length) of the HTTP 1.1 standard to work with these servers.

Here is a patch to VLC that seems to fix the issue by making VLC look for the Content-Length header and only reading that number of bytes from the server (instead of waiting for more until it times out after a few minutes) when reading from an MMSH stream:

This patch should no longer be needed, as is included in the latest VLC git trunk, and should also be included in the nightly builds.

vlcmms.patch

10 comments:

  1. Hi I'm trying to restream rtsp stream (rtsp://x.x.x.x/stream.sdp to httplive for iphone whithout transcode, but unable. would you be able to please provide command to use livehttp to mux to ts and split.
    thanks

    ReplyDelete

Note: Only a member of this blog may post a comment.