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(); } }
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; }
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(); } }