Exemple #1
0
        private static void MesasureTestPatternSourceFrameRate(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;
            }
        }
Exemple #2
0
        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);
        }