@@ -896,3 +896,68 @@ a=rtcp-fb:96 nack
896
896
runTest (t , true )
897
897
})
898
898
}
899
+
900
+ func TestMultiCodecNegotiation (t * testing.T ) {
901
+ const offerSdp = `v=0
902
+ o=- 781500112831855234 6 IN IP4 127.0.0.1
903
+ s=-
904
+ t=0 0
905
+ a=group:BUNDLE 0 1 2 3
906
+ a=extmap-allow-mixed
907
+ a=msid-semantic: WMS be0216be-f3d8-40ca-a624-379edf70f1c9
908
+ m=application 53555 UDP/DTLS/SCTP webrtc-datachannel
909
+ a=mid:0
910
+ a=sctp-port:5000
911
+ a=max-message-size:262144
912
+ m=video 9 UDP/TLS/RTP/SAVPF 98
913
+ a=mid:1
914
+ a=sendonly
915
+ a=msid:be0216be-f3d8-40ca-a624-379edf70f1c9 3d032b3b-ffe5-48ec-b783-21375668d1c3
916
+ a=rtcp-mux
917
+ a=rtcp-rsize
918
+ a=rtpmap:98 VP9/90000
919
+ a=rtcp-fb:98 goog-remb
920
+ a=rtcp-fb:98 transport-cc
921
+ a=rtcp-fb:98 ccm fir
922
+ a=rtcp-fb:98 nack
923
+ a=rtcp-fb:98 nack pli
924
+ a=fmtp:98 profile-id=0
925
+ a=rid:q send
926
+ a=rid:h send
927
+ a=simulcast:send q;h
928
+ m=video 9 UDP/TLS/RTP/SAVPF 96
929
+ a=mid:2
930
+ a=sendonly
931
+ a=msid:6ff05509-be96-4ef1-a74f-425e14720983 16d5d7fe-d076-4718-9ca9-ec62b4543727
932
+ a=rtcp-mux
933
+ a=rtcp-rsize
934
+ a=rtpmap:96 VP8/90000
935
+ a=rtcp-fb:96 goog-remb
936
+ a=rtcp-fb:96 transport-cc
937
+ a=rtcp-fb:96 ccm fir
938
+ a=rtcp-fb:96 nack
939
+ a=rtcp-fb:96 nack pli
940
+ a=ssrc:4281768245 cname:JDM9GNMEg+9To6K7
941
+ a=ssrc:4281768245 msid:6ff05509-be96-4ef1-a74f-425e14720983 16d5d7fe-d076-4718-9ca9-ec62b4543727
942
+ `
943
+ mustParse := func (raw string ) sdp.SessionDescription {
944
+ s := sdp.SessionDescription {}
945
+ assert .NoError (t , s .Unmarshal ([]byte (raw )))
946
+
947
+ return s
948
+ }
949
+ t .Run ("Multi codec negotiation disabled" , func (t * testing.T ) {
950
+ mediaEngine := MediaEngine {}
951
+ assert .NoError (t , mediaEngine .RegisterDefaultCodecs ())
952
+ assert .NoError (t , mediaEngine .updateFromRemoteDescription (mustParse (offerSdp )))
953
+ assert .Len (t , mediaEngine .negotiatedVideoCodecs , 1 )
954
+ })
955
+ t .Run ("Multi codec negotiation enabled" , func (t * testing.T ) {
956
+ mediaEngine := MediaEngine {}
957
+ mediaEngine .SetMultiCodecNegotiation (true )
958
+ assert .True (t , mediaEngine .MultiCodecNegotiation ())
959
+ assert .NoError (t , mediaEngine .RegisterDefaultCodecs ())
960
+ assert .NoError (t , mediaEngine .updateFromRemoteDescription (mustParse (offerSdp )))
961
+ assert .Len (t , mediaEngine .negotiatedVideoCodecs , 2 )
962
+ })
963
+ }
0 commit comments