@@ -88,6 +88,7 @@ pub struct MediaEngine {
8888 // If we have attempted to negotiate a codec type yet.
8989 pub ( crate ) negotiated_video : AtomicBool ,
9090 pub ( crate ) negotiated_audio : AtomicBool ,
91+ pub ( crate ) negotiate_multi_codecs : AtomicBool ,
9192
9293 pub ( crate ) video_codecs : Vec < RTCRtpCodecParameters > ,
9394 pub ( crate ) audio_codecs : Vec < RTCRtpCodecParameters > ,
@@ -335,6 +336,17 @@ impl MediaEngine {
335336 codecs. push ( codec) ;
336337 }
337338
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+
338350 /// register_codec adds codec to the MediaEngine
339351 /// These are the list of codecs supported by this PeerConnection.
340352 /// register_codec is not safe for concurrent use.
@@ -653,12 +665,14 @@ impl MediaEngine {
653665 desc : & SessionDescription ,
654666 ) -> Result < ( ) > {
655667 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 ) )
657670 && media. media_name . media . to_lowercase ( ) == "audio"
658671 {
659672 self . negotiated_audio . store ( true , Ordering :: SeqCst ) ;
660673 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 ) )
662676 && media. media_name . media . to_lowercase ( ) == "video"
663677 {
664678 self . negotiated_video . store ( true , Ordering :: SeqCst ) ;
0 commit comments