Skip to content

Commit 3ca11b4

Browse files
authored
Merge pull request #1440 from ChristopheI/master
Fix #1438: Video Stream are cut when, in a same PeeConnection, Video streams are added/removed
2 parents 77fbbd8 + 08a9707 commit 3ca11b4

File tree

1 file changed

+13
-29
lines changed

1 file changed

+13
-29
lines changed

src/net/RTP/RTPSession.cs

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,9 +1239,12 @@ public virtual SetDescriptionResultEnum SetRemoteDescription(SdpType sdpType, SD
12391239
return SetDescriptionResultEnum.TextIncompatible;
12401240
}
12411241
}
1242-
else if (currentMediaStream.RemoteTrack.Capabilities.Count != 0 && announcement.Port != 0 && (capabilities?.Count == 0 || (currentMediaStream.LocalTrack == null && currentMediaStream.LocalTrack != null && currentMediaStream.LocalTrack.Capabilities?.Count == 0)))
1242+
else if (currentMediaStream.MediaType == SDPMediaTypesEnum.video)
12431243
{
1244-
return SetDescriptionResultEnum.VideoIncompatible;
1244+
if (capabilities?.Count == 0 || (currentMediaStream.LocalTrack == null && currentMediaStream.LocalTrack != null && currentMediaStream.LocalTrack.Capabilities?.Count == 0))
1245+
{
1246+
return SetDescriptionResultEnum.VideoIncompatible;
1247+
}
12451248
}
12461249
}
12471250

@@ -1459,10 +1462,6 @@ private bool RemoveLocalTrack(MediaStreamTrack track)
14591462
{
14601463
RequireRenegotiation = true;
14611464
textStream.LocalTrack = null;
1462-
1463-
CloseMediaStream("normal", textStream);
1464-
IsVideoStarted = false;
1465-
TextStreamList.Remove(textStream);
14661465
return true;
14671466
}
14681467
}
@@ -1475,10 +1474,6 @@ private bool RemoveLocalTrack(MediaStreamTrack track)
14751474
{
14761475
RequireRenegotiation = true;
14771476
videoStream.LocalTrack = null;
1478-
1479-
CloseMediaStream("normal", videoStream);
1480-
IsVideoStarted = false;
1481-
VideoStreamList.Remove(videoStream);
14821477
return true;
14831478
}
14841479
}
@@ -1968,25 +1963,6 @@ private SDP GetSessionDescription(List<MediaStream> mediaStreamList, IPAddress c
19681963
}
19691964
}
19701965

1971-
if (localAddress == null)
1972-
{
1973-
foreach (var textStream in TextStreamList)
1974-
{
1975-
if (textStream.DestinationEndPoint != null && textStream.DestinationEndPoint.Address != null)
1976-
{
1977-
if (IPAddress.Any.Equals(textStream.DestinationEndPoint.Address) || IPAddress.IPv6Any.Equals(textStream.DestinationEndPoint.Address))
1978-
{
1979-
// If the remote party has set an inactive media stream via the connection address then we do the same.
1980-
localAddress = textStream.DestinationEndPoint.Address;
1981-
}
1982-
else
1983-
{
1984-
localAddress = NetServices.GetLocalAddressForRemote(textStream.DestinationEndPoint.Address);
1985-
}
1986-
}
1987-
}
1988-
}
1989-
19901966
if (localAddress == null)
19911967
{
19921968
if (connectionAddress == IPAddress.IPv6Any && NetServices.InternetDefaultIPv6Address != null)
@@ -2731,6 +2707,10 @@ public void SendRtpRaw(SDPMediaTypesEnum mediaType, byte[] payload, uint timesta
27312707
{
27322708
VideoStream?.SendRtpRaw(payload, timestamp, markerBit, payloadTypeID);
27332709
}
2710+
else if (mediaType == SDPMediaTypesEnum.text)
2711+
{
2712+
TextStream?.SendRtpRaw(payload, timestamp, markerBit, payloadTypeID);
2713+
}
27342714
}
27352715

27362716
/// <summary>
@@ -2819,6 +2799,10 @@ public void SendRtcpTWCCFeedback(SDPMediaTypesEnum mediaType, RTCPTWCCFeedback f
28192799
{
28202800
VideoStream?.SendRtcpTWCCFeedback(feedback);
28212801
}
2802+
else if (mediaType == SDPMediaTypesEnum.text)
2803+
{
2804+
TextStream?.SendRtcpTWCCFeedback(feedback);
2805+
}
28222806
}
28232807

28242808
/// <summary>

0 commit comments

Comments
 (0)