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

TryStopSendRtpData() private method

尝试停止摄像头码流发送 只有当关联摄像头通道为1时,才需要停止发送码流
private TryStopSendRtpData ( string cameraNo, string channelLabel ) : SmcErr
cameraNo string 摄像头编号
channelLabel string 原先关联的通道编号
return Cgw.SmcError.SmcErr
        private SmcErr TryStopSendRtpData(string cameraNo, string channelLabel)
        {
            SmcErr err = new CgwError();
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("TryStopSendRtpData start.");

            try
            {
                bool successed = this.cameraVideoRelationDicLocker.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME);
                // 申请互斥
                if (successed)
                {
                    try
                    {
                        if (!this.cameraVideoRelationDic.ContainsKey(cameraNo))
                        {
                            logEx.Trace("TryStopSendRtpData cameraNo={0}, channelLabel={1} can't find cameraNo.", cameraNo, channelLabel);
                            return err;
                        }
                        this.cameraVideoRelationDic[cameraNo].RemoveAll(a => { return a == channelLabel; });
                        // 判断通道是否已经存在
                        if (null == this.cameraVideoRelationDic[cameraNo] || 0 == this.cameraVideoRelationDic[cameraNo].Count)
                        {
                            logEx.Trace("TryStopSendRtpData StopReceiveVideoByPipe cameraNo={0},channelLabel={1}", cameraNo, channelLabel);
                            // 停止视频码流
                            CgwMonitorManageAdapter.Instance().StopReceiveVideoByPipe(cameraNo);

                            this.cameraVideoRelationDic.Remove(cameraNo);
                        }
                    }
                    finally
                    {
                        // 释放互斥量
                        this.cameraVideoRelationDicLocker.ExitWriteLock();
                    }
                }
                else
                {
                    // 日志
                    err.SetErrorNo(CgwError.ERR_CGW_CHANNEL_GET_LOCK_FAIL);
                    logEx.Error("TryStopSendRtpData: Enert Write Lock Failed.WaitingReadCount:{0};WaitingWriteCount:{1}.", this.cameraVideoRelationDicLocker.WaitingReadCount, this.cameraVideoRelationDicLocker.WaitingWriteCount);
                }
            }
            catch (Exception ex)
            {
                // 日志
                err.SetErrorNo(CgwError.ERR_CGW_CHANNEL_SERVICE_ADNORMAL);
                logEx.Error(ex, "TryStopSendRtpData: Enert Write Lock Exception.");
            }

            logEx.Trace("TryStopSendRtpData cameraNo={0}, channelLabel={1} successfully.", cameraNo, channelLabel);
            return err;
        }