BogdanovKirill / RtspClientSharp

Pure C# RTSP client for .NET Standard without external dependencies and with true async nature. I welcome contributions.
MIT License
694 stars 284 forks source link

Audio only RTSP source not working #129

Open freakalot opened 1 year ago

freakalot commented 1 year ago

Describe the bug Hi, we have a rtsp source which is an audio only stream. I tried to use the library and testet it with the SimplayeRtspCLient example. The Source is generated with Live555 Mediaserver providing an mp3 file over the RTSP protocol. The RtspClientSharp library just errors out with an exception:

RtspClientSharp.Rtsp.RtspClientException: Any suitable track is not found
   at RtspClientSharp.Rtsp.RtspClientInternal.<ConnectAsync>d__18.MoveNext() in C:\Tools\RtspClientSharp-master\RtspClientSharp\Rtsp\RtspClientInternal.cs:line 96
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at RtspClientSharp.RtspClient.<>c__DisplayClass13_0.<<ConnectAsync>b__0>d.MoveNext() in C:\Tools\RtspClientSharp-master\RtspClientSharp\RtspClient.cs:line 107
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at RtspClientSharp.RtspClient.<ConnectAsync>d__13.MoveNext() in C:\Tools\RtspClientSharp-master\RtspClientSharp\RtspClient.cs:line 51
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at SimpleRtspClient.Program.<ConnectAsync>d__1.MoveNext() in C:\Tools\RtspClientSharp-master\Examples\SimpleRtspClient\Program.cs:line 48

I found out that it cannot find the proper codec info. The SDP payload looks like this:

v=0
o=- 1669714399281536 1 IN IP4 10.100.7.35
s=MPEG-1 or 2 Audio, streamed by the LIVE555 Media Server
i=file.mp3
t=0 0
a=tool:LIVE555 Streaming Media v2022.11.19
a=type:broadcast
a=control:*
a=range:npt=0-9396.396
a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by the LIVE555 Media Server
a=x-qt-text-inf:file.mp3
m=audio 0 RTP/AVP 14
c=IN IP4 0.0.0.0
b=AS:128
a=control:track1

the crucial line is m=audio 0 RTP/AVP 14 as the payload number 14 is not implemented.

To Reproduce Steps to reproduce the behavior:

  1. Setup a rtsp stream with audio only (e.g. proving and mp3 file)
  2. Try to connect with the RtspClientSharp lib to this source
  3. Connect fails with the error message above

Expected behavior The library can consume the stream properly without any error message