Exemple #1
0
 public void ChangeVideoCfg(VideoEncodeCfg vCfg)
 {
     try
     {
         _vCfg = vCfg;
         if (_ce != null)
         {
             _ce.Error -= OnError;
             _ce.Stop();
             _ce.Dispose();
             _ce = null;
         }
         if (_vCfg.Params.ContainsKey("ScreenEncode") && (int)_vCfg.Params["ScreenEncode"] == 1)
         {
             _ce = new ScreenaEncoder(_vCfg, OnCaptured);
         }
         else
         {
             _ce = new CameraEncoder(_vCfg, OnCaptured);
         }
         _ce.Error += OnError;
         if (_isRuning)
         {
             if (IsVideoPub)
             {
                 _ce.Start();
             }
         }
     }
     catch (Exception e)
     {
         OnError(e);
         Stop();
     }
 }
Exemple #2
0
        private void Init()
        {
            if (_vCfg.Params.ContainsKey("ScreenEncode") && (int)_vCfg.Params["ScreenEncode"] == 1)
            {
                _ce = new ScreenaEncoder(_vCfg, OnCaptured);
            }
            else
            {
                _ce = new CameraEncoder(_vCfg, OnCaptured);
            }
            _ce.Error += OnError;

            _me        = new MicEncoder(_aCfg, OnCaptured);
            _me.Error += OnError;
        }
Exemple #3
0
        public void ChangeCfg(VideoEncodeCfg vCfg, AudioEncodeCfg aCfg)
        {
            try
            {
                _vCfg = vCfg;
                _aCfg = aCfg;

                if (_ce != null)
                {
                    _ce.Error -= OnError;
                    _ce.Stop();
                    _ce.Dispose();
                    _ce = null;
                }
                if (_me != null)
                {
                    _me.Error -= OnError;
                    _me.Stop();
                    _me.Dispose();
                    _me = null;
                }
                Init();

                if (_isRuning)
                {
                    if (IsVideoPub)
                    {
                        _ce.Start();
                    }
                    if (IsAudioPub)
                    {
                        _me.Start();
                    }
                }
            }
            catch (Exception e)
            {
                OnError(e);
                Stop();
            }
        }