Ejemplo n.º 1
0
 internal RTCTrackEvent(IntPtr ptrTransceiver, RTCPeerConnection peer)
 {
     Transceiver = WebRTC.FindOrCreate(
         ptrTransceiver, ptr => new RTCRtpTransceiver(ptr, peer));
 }
Ejemplo n.º 2
0
 internal MediaStreamTrackEvent(IntPtr ptrTrack)
 {
     Track = WebRTC.FindOrCreate(ptrTrack, MediaStreamTrack.Create);
 }
        /// <summary>
        /// Returns array of objects each of which represents one RTP transceiver.
        /// </summary>
        /// <example>
        /// <code>
        /// var transceivers = peerConnection.GetTransceivers();
        /// </code>
        /// </example>
        /// <returns> Array of the transceivers </returns>
        /// <seealso cref="GetSenders()"/>
        /// <seealso cref="GetReceivers()"/>
        public IEnumerable <RTCRtpTransceiver> GetTransceivers()
        {
            var buf = NativeMethods.PeerConnectionGetTransceivers(self, out ulong length);

            return(WebRTC.Deserialize(buf, (int)length, ptr => new RTCRtpTransceiver(ptr, this)));
        }
Ejemplo n.º 4
0
 RTCRtpTransceiver CreateTransceiver(IntPtr ptr)
 {
     return(WebRTC.FindOrCreate(ptr, _ptr => new RTCRtpTransceiver(_ptr, this)));
 }
Ejemplo n.º 5
0
 RTCRtpSender CreateSender(IntPtr ptr)
 {
     return(WebRTC.FindOrCreate(ptr, _ptr => new RTCRtpSender(_ptr, this)));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns array of objects each of which represents one RTP transceiver.
        /// </summary>
        /// <example>
        /// <code>
        /// var transceivers = peerConnection.GetTransceivers();
        /// </code>
        /// </example>
        /// <returns> Array of the transceivers </returns>
        /// <seealso cref="GetSenders()"/>
        /// <seealso cref="GetReceivers()"/>
        public IEnumerable <RTCRtpTransceiver> GetTransceivers()
        {
            var buf = WebRTC.Context.PeerConnectionGetTransceivers(GetSelfOrThrow(), out ulong length);

            return(WebRTC.Deserialize(buf, (int)length, CreateTransceiver));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a new VideoStream object.
        /// The track is created with a source texture `ptr`.
        /// It is noted that streamed video might be flipped when not action was taken. Almost case it has no problem to use other constructor instead.
        ///
        /// See Also: Texture.GetNativeTexturePtr
        /// </summary>
        /// <param name="texturePtr"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="format"></param>
        public VideoStreamTrack(IntPtr texturePtr, int width, int height, GraphicsFormat format, bool needFlip)
            : this(Guid.NewGuid().ToString(), new VideoTrackSource(), needFlip)
        {
            var error = WebRTC.ValidateTextureSize(width, height, Application.platform, WebRTC.GetEncoderType());

            if (error.errorType != RTCErrorType.None)
            {
                throw new ArgumentException(error.message);
            }
            WebRTC.ValidateGraphicsFormat(format);
            WebRTC.Context.SetVideoEncoderParameter(GetSelfOrThrow(), width, height, format, texturePtr);
            WebRTC.Context.InitializeEncoder(GetSelfOrThrow());
        }