/// <summary> /// Forwards media from the SIP session to the WebRTC session. /// </summary> /// <param name="mediaType">The type of media.</param> /// <param name="rtpPacket">The RTP packet received on the SIP session.</param> private static void ForwardMedia(SDPMediaTypesEnum mediaType, RTPPacket rtpPacket) { if (_peerConnection != null && mediaType == SDPMediaTypesEnum.audio) { _peerConnection.SendAudio((uint)rtpPacket.Payload.Length, rtpPacket.Payload); } }
/// <summary> /// Forwards media from the SIP session to the WebRTC session. /// </summary> /// <param name="remote">The remote endpoint the RTP packet was received from.</param> /// <param name="mediaType">The type of media.</param> /// <param name="rtpPacket">The RTP packet received on the SIP session.</param> private static void ForwardAudioToPeerConnection(IPEndPoint remote, SDPMediaTypesEnum mediaType, RTPPacket rtpPacket) { if (_peerConnection != null && _peerConnection.connectionState == RTCPeerConnectionState.connected && mediaType == SDPMediaTypesEnum.audio) { _peerConnection.SendAudio((uint)rtpPacket.Payload.Length, rtpPacket.Payload); } }
private static void AudioSource_OnAudioSourceEncodedSample(uint durationRtpUnits, byte[] sample) { PeerConnection.SendAudio(durationRtpUnits, sample); if (audioSink != null) { audioSink.GotAudioRtp(null, 0, 0, 0, 0, false, sample); } }