コード例 #1
0
        public HttpSourceMediaServer(string serverName, MediaResourceManager resourceManager, IServerLogger logger = null,
                                     string inputIp = "", int inputPort = -1, string outputIp = "", int outputPort = -1,
                                     List <string> inputWhiteList = null, string certFile = "", string certKey = "", Dictionary <string, int> channelInputQueueLengths = null)
        {
            InputQueueSize  = DEFAULT_INPUT_QUEUE_SIZE;
            InputBufferSize = DEFAULT_INPUT_BUFFER_SIZE;

            OutputQueueSize        = DEFAULT_OUTPUT_QUEUE_SIZE;
            OutputBufferSize       = DEFAULT_OUTPUT_BUFFER_SIZE;
            OutputSocketBufferSize = 0;  // use default value

            m_ServerName = serverName;

            m_CertFile = certFile;
            m_CertKey  = certKey;

            if (logger != null)
            {
                m_Logger = logger;
            }
            else
            {
                m_Logger = new ConsoleLogger();
            }

            m_ResourceManager = resourceManager;
            m_ResourceManager.AddServer(this);

            if (inputIp.Length > 0)
            {
                m_InputIp = inputIp;
            }
            if (outputIp.Length > 0)
            {
                m_OutputIp = outputIp;
            }

            if (inputPort >= 0)
            {
                m_InputPort = inputPort;
            }
            if (outputPort >= 0)
            {
                m_OutputPort = outputPort;
            }

            if (inputWhiteList != null)
            {
                m_InputWhiteList.AddRange(inputWhiteList);
            }
            if (m_InputWhiteList.Count <= 0)
            {
                m_InputWhiteList.Add("127.0.0.1");
            }

            if (channelInputQueueLengths != null)
            {
                m_ChannelInputQueueLengths = new Dictionary <string, int>(channelInputQueueLengths);
            }
        }