private void Init()
        {
            if (m_IsInit)
            {
                return;
            }
            if (RecordConfig == null)
            {
                NRDebugger.LogError("RecordConfig is null!!!!!");
            }
            BlendMode = RecordConfig.BlendMode;
            var config = RecordConfig.ToNativeConfig();

            if (!Directory.Exists(config.outPutPath))
            {
                Directory.CreateDirectory(config.outPutPath);
            }

            NRDebugger.LogError(config.ToString());
            Encoder     = new NREncoder(config);
            CameraInput = new CameraInput(Encoder, CaptureCamera, BlendMode, false);

            RGBTexture = new NRRGBCamTexture();
            PreviewScreen.SetData(RGBTexture.GetTexture(), false);
            PreviewScreen.gameObject.SetActive(false);
            RGBTexture.OnUpdate += OnFrame;
            m_IsInit             = true;
        }
        private void OnFrame(RGBTextureFrame frame)
        {
            if (!m_IsStarted)
            {
                return;
            }
            // update camera pose
            UpdateHeadPoseByTimestamp(frame.timeStamp);

            CameraInput.OnFrame(frame);

            PreviewScreen.SetData(CameraInput.BlendTexture, true);
        }
        public void SwitchMode(BlendMode mode)
        {
            if (m_IsStarted)
            {
                return;
            }

            BlendMode = mode;
            if (CameraInput != null)
            {
                CameraInput.Dispose();
            }
            CameraInput = new CameraInput(Encoder, CaptureCamera, BlendMode);
        }