Skip to content

Commit 9803b59

Browse files
committed
Added webrtc negotiation unit test for an inactive audio offer.
1 parent ee19ab0 commit 9803b59

File tree

1 file changed

+105
-2
lines changed

1 file changed

+105
-2
lines changed

test/integration/net/WebRTC/RTCPeerConnectionUnitTest.cs

+105-2
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,114 @@ public void CheckNoAudioNegotiationUnitTest()
736736
pc.Close("normal");
737737
}
738738

739+
/// <summary>
740+
/// Checks that an inactive audio track gets added if the offer contains inactive audio and sendrecv video but
741+
/// the local peer connection only supports video.
742+
/// </summary>
743+
[Fact]
744+
public void Check_Inactive_Audio_Negotiation_Test()
745+
{
746+
logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
747+
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
748+
749+
// By default offers made by us always put audio first. Create a remote SDP offer
750+
// with the video first.
751+
string remoteSdp =
752+
@"v=0
753+
o=- 62533 0 IN IP4 127.0.0.1
754+
s=-
755+
t=0 0
756+
a=group:BUNDLE 0 1
757+
a=msid-semantic: WMS
758+
m=video 9 UDP/TLS/RTP/SAVPF 96 97
759+
c=IN IP4 0.0.0.0
760+
a=rtcp:9 IN IP4 0.0.0.0
761+
a=ice-ufrag:Hvje
762+
a=ice-pwd:CXdPuoviwBPUGkw1PystrRs1
763+
a=ice-options:trickle
764+
a=fingerprint:sha-256 D6:82:3F:4F:23:A4:09:5A:BC:99:42:7D:E6:94:D8:2F:41:56:CF:01:14:35:1A:61:7B:95:C8:F4:FC:D5:3A:16
765+
a=setup:actpass
766+
a=mid:0
767+
a=extmap:1 urn:ietf:params:rtp-hdrext:toffset
768+
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
769+
a=extmap:3 urn:3gpp:video-orientation
770+
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
771+
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
772+
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
773+
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
774+
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
775+
a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid
776+
a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
777+
a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
778+
a=recvonly
779+
a=rtcp-mux
780+
a=rtcp-rsize
781+
a=rtpmap:96 VP8/90000
782+
a=rtcp-fb:96 goog-remb
783+
a=rtcp-fb:96 transport-cc
784+
a=rtcp-fb:96 ccm fir
785+
a=rtcp-fb:96 nack
786+
a=rtcp-fb:96 nack pli
787+
a=rtpmap:97 rtx/90000
788+
a=fmtp:97 apt=96
789+
m=audio 9 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
790+
c=IN IP4 0.0.0.0
791+
a=rtcp:9 IN IP4 0.0.0.0
792+
a=ice-ufrag:Hvje
793+
a=ice-pwd:CXdPuoviwBPUGkw1PystrRs1
794+
a=ice-options:trickle
795+
a=fingerprint:sha-256 D6:82:3F:4F:23:A4:09:5A:BC:99:42:7D:E6:94:D8:2F:41:56:CF:01:14:35:1A:61:7B:95:C8:F4:FC:D5:3A:16
796+
a=setup:actpass
797+
a=mid:1
798+
a=extmap:14 urn:ietf:params:rtp-hdrext:ssrc-audio-level
799+
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
800+
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
801+
a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid
802+
a=inactive
803+
a=rtcp-mux
804+
a=rtcp-rsize
805+
a=rtpmap:111 opus/48000/2
806+
a=rtcp-fb:111 transport-cc
807+
a=fmtp:111 minptime=10;useinbandfec=1
808+
a=rtpmap:63 red/48000/2
809+
a=fmtp:63 111/111
810+
a=rtpmap:9 G722/8000
811+
a=rtpmap:0 PCMU/8000
812+
a=rtpmap:8 PCMA/8000
813+
a=rtpmap:13 CN/8000
814+
a=rtpmap:110 telephone-event/48000
815+
a=rtpmap:126 telephone-event/8000";
816+
817+
// Create a local session and add the video track first.
818+
RTCPeerConnection pc = new RTCPeerConnection(null);
819+
MediaStreamTrack localVideoTrack = new MediaStreamTrack(SDPMediaTypesEnum.video, false, new List<SDPAudioVideoMediaFormat> { new SDPAudioVideoMediaFormat(SDPMediaTypesEnum.video, 96, "VP8", 90000) });
820+
pc.addTrack(localVideoTrack);
821+
822+
var offer = SDP.ParseSDPDescription(remoteSdp);
823+
824+
logger.LogDebug($"Remote offer: {offer}");
825+
826+
var result = pc.SetRemoteDescription(SIP.App.SdpType.offer, offer);
827+
828+
logger.LogDebug($"Set remote description on local session result {result}.");
829+
830+
Assert.Equal(SetDescriptionResultEnum.OK, result);
831+
832+
var answer = pc.CreateAnswer(null);
833+
834+
logger.LogDebug($"Local answer: {answer}");
835+
836+
Assert.Equal(MediaStreamStatusEnum.Inactive, pc.AudioStream.LocalTrack.StreamStatus);
837+
Assert.Equal(96, pc.VideoStream.LocalTrack.Capabilities.Single(x => x.Name() == "VP8").ID);
838+
839+
pc.Close("normal");
840+
}
841+
739842
/// <summary>
740843
/// Tests that two peer connection instances can reach the connected state.
741844
/// </summary>
742845
[Fact]
743-
public async void CheckPeerConnectionEstablishment()
846+
public async Task CheckPeerConnectionEstablishment()
744847
{
745848
logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
746849
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -799,7 +902,7 @@ public async void CheckPeerConnectionEstablishment()
799902
/// Tests that two peer connection instances can establish a data channel.
800903
/// </summary>
801904
[Fact]
802-
public async void CheckDataChannelEstablishment()
905+
public async Task CheckDataChannelEstablishment()
803906
{
804907
logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
805908
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);

0 commit comments

Comments
 (0)