@@ -88,6 +88,7 @@ pub struct MediaEngine {
88
88
// If we have attempted to negotiate a codec type yet.
89
89
pub ( crate ) negotiated_video : AtomicBool ,
90
90
pub ( crate ) negotiated_audio : AtomicBool ,
91
+ pub ( crate ) negotiate_multi_codecs : AtomicBool ,
91
92
92
93
pub ( crate ) video_codecs : Vec < RTCRtpCodecParameters > ,
93
94
pub ( crate ) audio_codecs : Vec < RTCRtpCodecParameters > ,
@@ -335,6 +336,17 @@ impl MediaEngine {
335
336
codecs. push ( codec) ;
336
337
}
337
338
339
+ /// set_multi_codec_negotiation enables or disables the negotiation of multiple codecs.
340
+ fn set_multi_codec_negotiation ( & mut self , negotiate_multi_codecs : bool ) {
341
+ self . negotiate_multi_codecs
342
+ . store ( negotiate_multi_codecs, Ordering :: SeqCst ) ;
343
+ }
344
+
345
+ /// multi_codec_negotiation returns the current state of the negotiation of multiple codecs.
346
+ fn multi_codec_negotiation ( & self ) -> bool {
347
+ self . negotiate_multi_codecs . load ( Ordering :: SeqCst )
348
+ }
349
+
338
350
/// register_codec adds codec to the MediaEngine
339
351
/// These are the list of codecs supported by this PeerConnection.
340
352
/// register_codec is not safe for concurrent use.
@@ -653,12 +665,14 @@ impl MediaEngine {
653
665
desc : & SessionDescription ,
654
666
) -> Result < ( ) > {
655
667
for media in & desc. media_descriptions {
656
- let typ = if !self . negotiated_audio . load ( Ordering :: SeqCst )
668
+ let typ = if ( !self . negotiated_audio . load ( Ordering :: SeqCst )
669
+ || self . negotiate_multi_codecs . load ( Ordering :: SeqCst ) )
657
670
&& media. media_name . media . to_lowercase ( ) == "audio"
658
671
{
659
672
self . negotiated_audio . store ( true , Ordering :: SeqCst ) ;
660
673
RTPCodecType :: Audio
661
- } else if !self . negotiated_video . load ( Ordering :: SeqCst )
674
+ } else if ( !self . negotiated_video . load ( Ordering :: SeqCst )
675
+ || self . negotiate_multi_codecs . load ( Ordering :: SeqCst ) )
662
676
&& media. media_name . media . to_lowercase ( ) == "video"
663
677
{
664
678
self . negotiated_video . store ( true , Ordering :: SeqCst ) ;
0 commit comments