Cgw.Channel.MonitorChannelRelationManager.StopChannelData C# (CSharp) Method

StopChannelData() public method

清除管道数据
public StopChannelData ( ) : void
return void
        public void StopChannelData()
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            SmcErr err = new CgwError();

            logEx.Trace("start StopChannelData");

            //copy 一份,防止长时间占用锁
            Dictionary<string, MonitorChannelRelation> monitorChannelRelationDicTemp = null;
            try
            {
                monitorChannelRelationDicTemp = new Dictionary<string, MonitorChannelRelation>(monitorChannelRelationDic);
            }
            catch (Exception e)
            {
                logEx.Error("StopChannelData.Execption message:{0}", e.Message);
            }

            if (monitorChannelRelationDicTemp == null)
            {
                //记录日志,获取*监控平台的摄像头列表失败
                logEx.Error("stopChannelVideo failed.No any monitorChannelRelationDic.");
            }
            //循环通道关系字典
            foreach (KeyValuePair<string, MonitorChannelRelation> monitorChannelRelation in monitorChannelRelationDicTemp)
            {
                ////2015/2/13 待测试,判断方式不正确
                if (monitorChannelRelation.Value.IsValid && !string.IsNullOrEmpty(monitorChannelRelation.Value.ConfAccessCode) && !string.IsNullOrEmpty(monitorChannelRelation.Value.CameraNo))
                //if (monitorChannelRelation.Value.IsValid && monitorChannelRelation.Value.ConfAccessCode != "" && monitorChannelRelation.Value.CameraNo != "")
                {
                    string cameraCode = monitorChannelRelation.Value.CameraNo;
                    string channelLabel = monitorChannelRelation.Value.Label;
                    // 停止码流
                    SmcErr errs = this.TryStopSendRtpData(cameraCode, channelLabel);
                    if (!errs.IsSuccess())
                    {
                        logEx.Trace("stopChannelVideo cameraNo:{0} stoprtp failed,errNo={1}.", cameraCode, err.ErrNo);
                    }
                    else
                    {
                        logEx.Trace("stopChannelVideo cameraNo:{0} stoprtp success ", cameraCode);
                    }

                    // 关闭音频码流
                    errs = this.SetCameraAudio(channelLabel, cameraCode, false);
                    if (!err.IsSuccess())
                    {
                        logEx.Trace("stopChannelVideo channelLabel:{0},cameraNo:{1} StartAudio failed,errNo={2}.", channelLabel, cameraCode, err.ErrNo);
                    }
                    else
                    {
                        logEx.Trace("stopChannelVideo cameraNo:{0} stoprtp success ", cameraCode);
                    }
                }
            }
        }