CgwMonitorManage.T28181.SipStackAdapter.StopRecvStream C# (CSharp) Method

StopRecvStream() public method

停止接收rtp数据包
public StopRecvStream ( UInt32 channel ) : EM_SIP_RESULT
channel System.UInt32
return EM_SIP_RESULT
        public EM_SIP_RESULT StopRecvStream(UInt32 channel)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: SipStackAdapter.StopRecvStream channel = {0}.", channel);

            try
            {
                //停止实况
                int responseID = 0;
                foreach (KeyValuePair<UInt32, int> kvp in channelResponseIDDic)
                {
                    if (kvp.Key == channel)
                    {
                        responseID = kvp.Value;
                        channelResponseIDDic.Remove(kvp.Key);
                        break;
                    }
                }
                EM_SIP_RESULT iRet = SIP_SDK_BYE(responseID);
                if (iRet != EM_SIP_RESULT.RET_SUCCESS)
                {
                    logEx.Error("StopRecvStream failed channel={0}", channel);
                }
                //释放用户数据内存
                foreach (KeyValuePair<UInt32, IntPtr> kvp in channelInPtrDic)
                {
                    if (kvp.Key == channel)
                    {
                        Marshal.FreeHGlobal(kvp.Value);
                        channelInPtrDic.Remove(kvp.Key);
                        break;
                    }
                }

                //释放NETSOURCE通道资源
                IVS_NETSOURCE_RESULT iNet = IVS_NETSOURCE_FreeChannel(channel);
                if (iNet != IVS_NETSOURCE_RESULT.SUCCESS)
                {
                    logEx.Error("IVS_NETSOURCE_FreeChannel failed channel={0}", channel);
                    return EM_SIP_RESULT.RET_FAILURE;
                }
                return iRet;
            }
            catch (System.Exception ex)
            {
                logEx.Error("StopRecvStream failed.Exception message:{0}", ex.Message);
                return EM_SIP_RESULT.RET_FAILURE;
            }
        }