/// <summary> /// 每帧录制帧数回调 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> protected virtual void VideoStreamer_NewFrame(object sender, NewFrameEventArgs eventArgs) { this.VideoWriter.WriteVideoFrame((Bitmap)eventArgs.Frame.Clone()); //每100帧回收一次虚拟内存 if ((TotalFrame++) % 100 == 0) { WindowApi.ClearMemory(); } }
/// <summary> /// 摄像头回调 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void Camera_NewFrame(object sender, NewFrameEventArgs eventArgs) { this.VideoWriter.WriteVideoFrame((Bitmap)eventArgs.Frame.Clone()); //每100帧回收一次虚拟内存 if ((TotalFrame++) % 100 == 0) { WindowApi.ClearMemory(); } }