Simple rtsp server

Topics: Question
Jul 27, 2015 at 6:01 PM
Edited Jul 27, 2015 at 6:04 PM
Hi,

I'm just trying to get a simple rtsp server but it doesn't work. The log write "RestartFaultedStreams"

Steps to reproduce :
  1. build the net7mma-111212 solution.
  2. create a new ConsoleApplication and import all dll as reference.
  3. copy/paste the snippet provided in the documentation
var server = new Media.Rtsp.RtspServer(System.Net.IPAddress.Any, 554) {
    Logger = new Media.Rtsp.Server.RtspServerConsoleLogger()
};
var source = new Media.Rtsp.Server.MediaTypes.RtspSource(
                "TEST",
                @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
);
server.TryAddMedia(source);
server.Start();
The debug log :
Server Started @ 27/07/2015 17:19:40
Starting Stream: TEST Id=02246721-6bf7-438b-ab29-df08ff882caa
Listening on: 0.0.0.0:554
RestartFaultedStreams
DisconnectAndRemoveInactiveSessions
RestartFaultedStreams
DisconnectAndRemoveInactiveSessions
RestartFaultedStreams
DisconnectAndRemoveInactiveSessions
RestartFaultedStreams
When i use VLC as a rtspclient "rtsp://192.168.0.31:554/live/TEST", it throws an error.

Could you help me to work with this great project.
thx
Jul 27, 2015 at 6:51 PM
The problem come from VLC. It appears that VLC is a piece of shit since v2.0 (grey screen, freeze due to cache error...).

I've tried to play with smplayer and it works !
Marked as answer by cpkun on 7/27/2015 at 12:05 PM
Coordinator
Jul 27, 2015 at 11:41 PM
Edited Jul 27, 2015 at 11:44 PM
I think your patch should be
             //Check the Scheme
            if (false == (location.Scheme.StartsWith(RtspMessage.MessageIdentifier, StringComparison.InvariantCultureIgnoreCase) 
                &&
                (location.Scheme != System.Uri.UriSchemeHttp && location.Scheme != System.Uri.UriSchemeHttps))) 
                throw new ArgumentException("Uri Scheme must be rtsp or http", "location");
Or perhaps
 //Check the Scheme
            if (false == location.Scheme.StartsWith(RtspMessage.MessageIdentifier, StringComparison.InvariantCultureIgnoreCase)
                &&
               false == location.Scheme.StartsWith(System.Uri.UriSchemeHttp, StringComparison.InvariantCultureIgnoreCase))
                throw new ArgumentException("Uri Scheme must start with rtsp or http", "location");
Not sure why it's required though, especially for things to work correctly...

An example would be nice :)
Jul 28, 2015 at 9:35 PM
Edited Jul 28, 2015 at 9:35 PM
with this code which get stream from a security camera
           var s = new Media.Rtsp.Server.MediaTypes.RtspSource(
                "TEST",
                @"http://192.168.0.181/Streaming/channels/1/httpPreview"
            );
            _server.TryAddMedia(s);
            _server.Start();
you can easyly reproduce this exception of the 111212 revision.
Your second snippet above seems better.