Ejemplo n.º 1
0
        public RtpReceiver(IntPtr native)
        {
            _native = new RtpReceiverSafeHandle(native);

            // Get the track, check the type then wrap it
            var trackPtr = RtpReceiverInterops.GetTrack(_native);

            Track = MediaStreamTrackInterop.IsAudioTrack(trackPtr)
                ? (MediaStreamTrack) new AudioTrack(trackPtr)
                : (MediaStreamTrack) new VideoTrack(trackPtr);
        }
Ejemplo n.º 2
0
        public MediaStreamTrack(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
            {
                throw new ArgumentException(nameof(handle));
            }
            Handle = new MediaStreamTrackSafeHandle(handle);

            var nativeIdString = MediaStreamTrackInterop.Id(Handle);

            if (nativeIdString == IntPtr.Zero)
            {
                Id = null;
            }
            else
            {
                Id = Marshal.PtrToStringAnsi(nativeIdString);
            }
        }
 protected override void ReleaseHandle(IntPtr handle) => MediaStreamTrackInterop.Destroy(handle);