コード例 #1
0
        /// <summary>
        /// No longer used but still keep here for integration tests
        /// </summary>
        /// <param name="track"></param>
        /// <param name="streamId">Id of the stream, doesn't have to exist</param>
        /// <exception cref="AddTrackFailedException"></exception>
        /// <remarks>Can be called from anythread, the libWebRTC will proxy to the correct thread</remarks>
        /// <returns>RtpSender, this PeerConnection takes ownership</returns>
        internal RtpSender AddTrack(MediaStreamTrack track, Guid streamId)
        {
            SafetyCheck();
            Require.NotNull(track);
            Require.NotEmpty(streamId);
            var rtpSenderPtr = PeerConnectionInterop.AddTrack(_handle, track.Handle, streamId.ToString());

            if (rtpSenderPtr == IntPtr.Zero)
            {
                throw new AddTrackFailedException();
            }
            var rtpSender = new RtpSender(rtpSenderPtr, _signallingThread);

            return(rtpSender);
        }
コード例 #2
0
 /// <summary>
 /// No longer used but still keep it here for tests
 /// </summary>
 /// <param name="rtpSender">The track, represented by its RtpSender</param>
 /// <remarks>Can be called from any thread, will be proxied to signalling thread by the lib.</remarks>
 internal void RemoveTrack(RtpSender rtpSender)
 {
     SafetyCheck();
     PeerConnectionInterop.RemoveTrack(_handle, rtpSender.Handle);
 }