private static void ForwardVideoFrameToPeerConnection(IPEndPoint remoteEP, uint timestamp, byte[] frame, VideoFormat format) { if (_peerConnection != null && _peerConnection.connectionState == RTCPeerConnectionState.connected) { _peerConnection.SendVideo(3000, frame); } }
public void SendFrame(uint duration, byte[] data) { if (ConnectedPeer == null || ConnectedPeer.connectionState != RTCPeerConnectionState.connected) { return; } ConnectedPeer.SendVideo(duration, data); }
private static void TestPatternSource_OnVideoSourceRawSample(uint durationMilliseconds, int width, int height, byte[] sample, SIPSorceryMedia.Abstractions.V1.VideoPixelFormatsEnum pixelFormat) { if (_startTime == DateTime.MinValue) { _startTime = DateTime.Now; } _frameCount++; if (DateTime.Now.Subtract(_startTime).TotalSeconds > 5) { double fps = _frameCount / DateTime.Now.Subtract(_startTime).TotalSeconds; Console.WriteLine($"Frame rate {fps:0.##}fps."); _startTime = DateTime.Now; _frameCount = 0; } var encodeResult = encoder.EncodeFrameH264(sample); peer.SendVideo(3000, encodeResult.frameBuffer); }