internal override void OnAttached(WebRTC webRtc) { Debug.Assert(webRtc != null); if (WebRtc != null) { throw new InvalidOperationException("The source is has already been assigned to another WebRTC."); } var type = MediaType == MediaType.Video ? MediaSourceType.VideoTest : MediaSourceType.AudioTest; NativeWebRTC.AddMediaSource(webRtc.Handle, type, out uint sourceId). ThrowIfFailed($"Failed to add {MediaType.ToString()} MediaTestSource."); WebRtc = webRtc; SourceId = sourceId; }
internal override void OnAttached(WebRTC webRtc) { Debug.Assert(webRtc != null); if (WebRtc != null) { Log.Error(WebRTCLog.Tag, "The source is has already been assigned to another WebRTC."); throw new InvalidOperationException("The source is has already been assigned to another WebRTC."); } NativeWebRTC.AddMediaSource(webRtc.Handle, MediaSourceType.MediaPacket, out uint sourceId). ThrowIfFailed("Failed to add MediaPacketSource."); WebRtc = webRtc; SourceId = sourceId; AudioConfiguration?.OnWebRTCSet(); VideoConfiguration?.OnWebRTCSet(); SetMediaStreamInfo(_audioMediaFormat); SetMediaStreamInfo(_videoMediaFormat); }