Skip to content

Commit 98e924e

Browse files
committed
B Fixed SSRC of the connection #23
1 parent 0337b9c commit 98e924e

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Nullable>disable</Nullable>
66
<ImplicitUsings>disable</ImplicitUsings>
77
<Title>$(ProjectName)</Title>
8-
<Version>0.4.2</Version>
8+
<Version>0.4.3</Version>
99
<Authors>Lukas Volf</Authors>
1010
<Copyright>MIT</Copyright>
1111
<PackageProjectUrl>https://github.com/jimm98y/SharpRealTimeStreaming</PackageProjectUrl>

src/SharpRTSPServer/RTSPConnection.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ namespace SharpRTSPServer
88
/// </summary>
99
public class RTSPConnection
1010
{
11-
private static readonly Random _rand = new Random();
12-
1311
/// <summary>
1412
/// RTSP conneciton listener.
1513
/// </summary>
@@ -26,7 +24,7 @@ public class RTSPConnection
2624
/// <summary>
2725
/// SSRC value used with this client connection.
2826
/// </summary>
29-
public uint SSRC { get; set; } = (uint)_rand.Next(0, int.MaxValue);
27+
public uint SSRC { get; set; }
3028

3129
/// <summary>
3230
/// RTSP Session ID used with this client connection.

src/SharpRTSPServer/RTSPServer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ private void HandleSetup(RtspListener listener, RtspRequestSetup setupMessage)
461461

462462
lock (_connectionList)
463463
{
464+
// set SSRC of the connection to the track's SSRC
465+
var connection = _connectionList.Single(x => x.Listener == listener);
466+
connection.SSRC = trackSSRC;
467+
464468
foreach (var setupConnection in _connectionList.Where(connection => connection.Listener.RemoteEndPoint.Address == listener.RemoteEndPoint.Address))
465469
{
466470
// Check the Track ID to determine if this is a SETUP for the Video Stream

src/SharpRTSPServer/Tracks/TrackBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public abstract class TrackBase : ITrack
1010
private static readonly Random _rand = new Random();
1111

1212
/// <summary>
13-
/// SSRC for this track.
13+
/// SSRC for this track. Each track streamed by this server shall have a unique SSRC.
1414
/// </summary>
1515
public uint SSRC { get; set; } = (uint)_rand.Next(0, int.MaxValue);
1616

0 commit comments

Comments
 (0)