Skip to content

Commit f832c52

Browse files
committed
B Fixed crash with multiple instances
1 parent 34725f4 commit f832c52

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/SharpRTSPClient/RTSPClient.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ private enum RtspStatus { WaitingToConnect, Connecting, ConnectFailed, Connected
110110
/// </summary>
111111
public uint AudioSSRC { get; set; } = (uint)_rand.Next(20000, 29999);
112112

113+
static RTSPClient()
114+
{
115+
try
116+
{
117+
RtspUtils.RegisterUri();
118+
}
119+
catch(Exception ex)
120+
{
121+
if(Log.ErrorEnabled) Log.Error(ex.Message);
122+
}
123+
}
124+
113125
/// <summary>
114126
/// Default ctor.
115127
/// </summary>
@@ -137,8 +149,6 @@ public RTSPClient(ILoggerFactory loggerFactory)
137149
/// <param name="playbackSession">Playback session.</param>
138150
public void Connect(string url, RTPTransport rtpTransport, string username = null, string password = null, MediaRequest mediaRequest = MediaRequest.VIDEO_AND_AUDIO, bool playbackSession = false)
139151
{
140-
RtspUtils.RegisterUri();
141-
142152
_logger.LogDebug("Connecting to {url} ", url);
143153
_uri = new Uri(url);
144154

src/SharpRTSPClient/SharpRTSPClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
1414
<Nullable>disable</Nullable>
1515
<Title>$(ProjectName)</Title>
16-
<Version>0.0.3</Version>
16+
<Version>0.0.4</Version>
1717
<Authors>Lukas Volf</Authors>
1818
<Copyright>MIT</Copyright>
1919
<PackageProjectUrl>https://github.com/jimm98y/SharpRealTimeStreaming</PackageProjectUrl>

0 commit comments

Comments
 (0)