pub async fn create_answer(
        &self,
        _options: Option<RTCAnswerOptions>,
    ) -> Result<RTCSessionDescription> {
        let use_identity = self.idp_login_url.is_some();
        if self.remote_description().await.is_none() {
            return Err(Error::ErrNoRemoteDescription);
        } else if use_identity {
            return Err(Error::ErrIdentityProviderNotImplemented);
        } else if self.internal.is_closed.load(Ordering::SeqCst) {
            return Err(Error::ErrConnectionClosed);
        } else if self.signaling_state() != RTCSignalingState::HaveRemoteOffer
            && self.signaling_state() != RTCSignalingState::HaveLocalPranswer
        {
            return Err(Error::ErrIncorrectSignalingState);
        }

        let mut connection_role = self
            .internal
            .setting_engine
            .answering_dtls_role
            .to_connection_role();
        if connection_role == ConnectionRole::Unspecified {
            connection_role = DEFAULT_DTLS_ROLE_ANSWER.to_connection_role();
        }

        let local_transceivers = self.get_transceivers().await;
        let mut d = self
            .internal
            .generate_matched_sdp(
                local_transceivers,
                use_identity,
                false, /*includeUnmatched */
                connection_role,
                self.configuration.sdp_semantics,
            )
            .await?;

        {
            let mut sdp_origin = self.internal.sdp_origin.lock().await;
            update_sdp_origin(&mut sdp_origin, &mut d);
        }
        let sdp = d.marshal();

        let answer = RTCSessionDescription {
            sdp_type: RTCSdpType::Answer,
            sdp,
            parsed: Some(d),
        };

        {
            let mut last_answer = self.internal.last_answer.lock().await;
            *last_answer = answer.sdp.clone();
        }
        Ok(answer)
    }
/// create_answer starts the PeerConnection and generates the localDescription
create_answer starts the PeerConnection and generates the localDescription
create_answer starts the PeerConnection and generates the localDescription
pub async fn create_answer(
        &self,
        _options: Option<RTCAnswerOptions>,
    ) -> Result<RTCSessionDescription> {
        let use_identity = self.idp_login_url.is_some();
        if self.remote_description().await.is_none() {
            return Err(Error::ErrNoRemoteDescription);
        } else if use_identity {
            return Err(Error::ErrIdentityProviderNotImplemented);
        } else if self.internal.is_closed.load(Ordering::SeqCst) {
            return Err(Error::ErrConnectionClosed);
        } else if self.signaling_state() != RTCSignalingState::HaveRemoteOffer
            && self.signaling_state() != RTCSignalingState::HaveLocalPranswer
        {
            return Err(Error::ErrIncorrectSignalingState);
        }
        let mut connection_role = self
            .internal
            .setting_engine
            .answering_dtls_role
            .to_connection_role();
        if connection_role == ConnectionRole::Unspecified {
            connection_role = DEFAULT_DTLS_ROLE_ANSWER.to_connection_role();
        }
        let local_transceivers = self.get_transceivers().await;
        let mut d = self
            .internal
            .generate_matched_sdp(
                local_transceivers,
                use_identity,
                false, /*includeUnmatched */
                connection_role,
                self.configuration.sdp_semantics,
            )
            .await?;
        {
            let mut sdp_origin = self.internal.sdp_origin.lock().await;
            update_sdp_origin(&mut sdp_origin, &mut d);
        }
        let sdp = d.marshal();
        let answer = RTCSessionDescription {
            sdp_type: RTCSdpType::Answer,
            sdp,
            parsed: Some(d),
        };
        {
            let mut last_answer = self.internal.last_answer.lock().await;
            *last_answer = answer.sdp.clone();
        }
        Ok(answer)
    }
pub async fn create_answer ( & self , _options : Option < RTCAnswerOptions > , ) -> Result < RTCSessionDescription > { let use_identity = self . idp_login_url . is_some ( ) ; if self . remote_description ( ) . await . is_none ( ) { return Err ( Error :: ErrNoRemoteDescription ) ; } else if use_identity { return Err ( Error :: ErrIdentityProviderNotImplemented ) ; } else if self . internal . is_closed . load ( Ordering :: SeqCst ) { return Err ( Error :: ErrConnectionClosed ) ; } else if self . signaling_state ( ) != RTCSignalingState :: HaveRemoteOffer && self . signaling_state ( ) != RTCSignalingState :: HaveLocalPranswer { return Err ( Error :: ErrIncorrectSignalingState ) ; } let mut connection_role = self . internal . setting_engine . answering_dtls_role . to_connection_role ( ) ; if connection_role == ConnectionRole :: Unspecified { connection_role = DEFAULT_DTLS_ROLE_ANSWER . to_connection_role ( ) ; } let local_transceivers = self . get_transceivers ( ) . await ; let mut d = self . internal . generate_matched_sdp ( local_transceivers , use_identity , false , /*includeUnmatched */ connection_role , self . configuration . sdp_semantics , ) . await ? ; { let mut sdp_origin = self . internal . sdp_origin . lock ( ) . await ; update_sdp_origin ( & mut sdp_origin , & mut d ) ; } let sdp = d . marshal ( ) ; let answer = RTCSessionDescription { sdp_type : RTCSdpType :: Answer , sdp , parsed : Some ( d ) , } ; { let mut last_answer = self . internal . last_answer . lock ( ) . await ; * last_answer = answer . sdp . clone ( ) ; } Ok ( answer ) }
create_answer starts the PeerConnection and generates the localDescription
create_answer starts the PeerConnection and generates the localDescription
&self
_options
Option<RTCAnswerOptions>