red5-0.9.1 边服务器搭建

red5 边服务器是通过mian框架完成的,就我理解,就是边服务器接收客户端的rtmp请求后再转发给原服务器处理。

关于边服务器的类,个人理解:

org.red5.server.net.rtmp.EdgeRTMPMinaIoHandler - 接收到客户连接后注册ioSession

org.red5.server.net.rtmp.RTMPConnManager  - 持有客户端连接(ioSession)

 

org.red5.server.net.mrtmp.EdgeMRTMPHandler - 连接源服务器成功后注册ioSession

org.red5.server.net.mrtmp.SimpleMRTMPEdgeManager - 持有源服务器的连接(ioSession)

 

主要配置文件有:

源:

conf/red5.properties -  主要配置端口和ip

conf/red5.xml - 上下文的配置,和不同模块的spring加载

conf/red5-origin-core.xml 源服务的核心配置

边:

conf/red5.properties -  主要配置端口和ip

conf/red5.xml - 上下文的配置,和不同模块的spring加载

conf/red5-edge-core.xml 边服务的核心配置

 

我遇到的问题:

边服务不能转发请求给源服务, 排查问题后, 发现类 org.red5.server.net.rtmp.EdgeRTMPHandler(messageReceived 71) 转换枚举类型错误,StreamAction.valueOf(action),修改成如下代码,正常运行 

 

if (call.getServiceName() == null && !conn.isConnected()
					&& action.equals(StreamAction.CONNECT.toString())) {
				handleConnect(conn, channel, header, (Invoke) message, (RTMP) state);
				return;
			}

附件中的red5-0.9.1.jar是我修改后的,直接修改名称为red5.jar 覆盖原有的red5.jar即可 

 

 

注:red5 的log配置文件屏蔽了一些类的日志,可根据自身情况修改 conf/logback.xml 日志文件的配置,查看更详细的信息

 

 

以下是我运行成功的配器文件内容

一、源服务器,主要配置文件

conf/red5.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:lang="http://www.springframework.org/schema/lang"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                           http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">

	<!-- This file just wires together the context tree. Its accessed by ContextSingletonBeanFactoryLocator -->
	
	<bean id="placeholderConfig"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:/red5.properties" />
	</bean>

	<!-- First we load the common context, its shared between all the other contexts -->
	<!-- Global context serves are the parent to all child contexts. -->
	<bean id="red5.common"
  	    class="org.springframework.context.support.FileSystemXmlApplicationContext">
    	<constructor-arg><list><value>classpath:/red5-common.xml</value></list></constructor-arg>
	</bean>
	
	<!-- Then we load the core context, with the common as parent --> 
	<!-- Context holding all the networking, users should need to edit. -->
	<bean id="red5.core"
  	    class="org.springframework.context.support.FileSystemXmlApplicationContext">
    	<constructor-arg><list><value>classpath:/red5-origin-core.xml</value></list></constructor-arg>
    	<constructor-arg><ref bean="red5.common" /></constructor-arg>
	</bean>

	<!-- Then we load the global contexts, note its important this happens before app container loads -->
	<bean id="context.loader" 
		class="org.red5.server.ContextLoader"
		init-method="init">
		<property name="parentContext" ref="red5.core" />
		<property name="contextsConfig" value="classpath:red5.globals" />
	</bean>	
	
	<!-- Now we can load the servlet engine, this has to happen after the context are loaded -->
<!-- 
 	<bean id="jetty6.server" class="org.red5.server.jetty.JettyLoader" init-method="init" autowire="byType" depends-on="context.loader">
		<property name="webappFolder" value="${red5.root}/webapps" />
	</bean>
-->
	<!-- Tomcat servlet engine / http server -->
	<bean id="tomcat.server" class="org.red5.server.tomcat.TomcatLoader" init-method="init" destroy-method="shutdown" depends-on="context.loader">

		<property name="webappFolder" value="${red5.root}/webapps" />
			      
	    <property name="connector">
			<bean class="org.apache.catalina.connector.Connector">
				<constructor-arg type="java.lang.String" value="org.apache.coyote.http11.Http11Protocol" />
		        <property name="port"><value>${http.port}</value></property>
		        <property name="redirectPort"><value>${https.port}</value></property>
		        <property name="enableLookups"><value>false</value></property>
			</bean>
	    </property>
	    	
        <property name="baseHost">
	       <bean class="org.apache.catalina.core.StandardHost">
	           <property name="name" value="${http.host}" />
	           <property name="unpackWARs" value="true" />
	           <property name="autoDeploy" value="true" />
	           <property name="xmlValidation" value="false" />
	           <property name="xmlNamespaceAware" value="false" />
	       </bean>	   
	    </property>		

		<property name="valves">
      		<list>
	    		<bean id="valve.access" class="org.apache.catalina.valves.AccessLogValve">
	                <property name="directory" value="log" />
	                <property name="prefix" value="${http.host}_access." />
	                <property name="suffix" value=".log" />
	                <property name="pattern" value="common" />
	                <property name="resolveHosts" value="false" />
	                <property name="rotatable" value="true" />
	        	</bean>
        	</list>
        </property>
	    
	</bean>

<!--
	<bean id="tomcat.server" class="org.red5.server.tomcat.TomcatLoader" init-method="init" destroy-method="shutdown" autowire="byType" depends-on="context.loader">
		<!- - Note: the webapp root folder must be specified before the "contexts" property - ->
		<property name="webappFolder" value="${red5.root}/webapps" />
	
	    <property name="embedded">
	    	<bean class="org.apache.catalina.startup.Embedded" />
	    </property>
	  
	    <property name="engine">
			<bean class="org.apache.catalina.core.StandardEngine">
		        <property name="name" value="red5Engine" />
		        <property name="defaultHost" value="localhost" />
			</bean>	  
	    </property>
	    
	    <property name="realm">
	    	<bean class="org.apache.catalina.realm.MemoryRealm" />
		</property>
			      
	    <property name="connector">
			<bean class="org.apache.catalina.connector.Connector">
		        <property name="port"><value>5080</value></property>
		        <property name="redirectPort"><value>8443</value></property>
		        <property name="enableLookups"><value>false</value></property>
			</bean>
	    </property>
	    	
        <property name="baseHost">
	       <bean class="org.apache.catalina.core.StandardHost">
	           <property name="name" value="localhost" />
	           <property name="unpackWARs" value="true" />
	           <property name="autoDeploy" value="true" />
	           <property name="xmlValidation" value="false" />
	           <property name="xmlNamespaceAware" value="false" />
	       </bean>	   
	    </property>		

		<property name="valves">
      		<list>
	    		<bean id="valve.access" class="org.apache.catalina.valves.AccessLogValve">
	                <property name="directory" value="." />
	                <property name="prefix" value="localhost_access." />
	                <property name="suffix" value=".log" />
	                <property name="pattern" value="common" />
	                <property name="resolveHosts" value="false" />
	                <property name="rotatable" value="true" />
	        	</bean>
        	</list>
        </property>
	    
        <property name="contexts">
		    <map>
		      <entry>
		        <key><value>/</value></key>
		        <value>/root</value>
		      </entry>
		    </map>
  		</property>
	</bean>     	
-->
	<!-- Default context. This can be shared between web app contexts -->
	
	<bean id="default.context"
  	    class="org.springframework.context.support.FileSystemXmlApplicationContext">
    	<constructor-arg><value>/webapps/red5-default.xml</value></constructor-arg>
    	<constructor-arg><ref bean="red5.common" /></constructor-arg>
	</bean>
	
	<!-- You can add further contexts here. This allows for multiple separate global scopes --> 	
	
</beans>

 

conf/red5-origin-core.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:lang="http://www.springframework.org/schema/lang"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd                            
	http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
	<!-- This context holds all the networking: mina -->

	<bean id="customEditorConfigurer"
		class="org.springframework.beans.factory.config.CustomEditorConfigurer">
		<property name="customEditors">
			<map>
				<entry key="java.net.SocketAddress">
					<bean
						class="org.apache.mina.integration.beans.InetSocketAddressEditor" />
				</entry>
			</map>
		</property>
	</bean>
	
	<bean id="placeholderConfig"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:/red5.properties" />
	</bean>

	<!-- RTMP Handler -->
	<bean id="rtmpHandler"
		class="org.red5.server.net.rtmp.RTMPHandler">
		<property name="server" ref="red5.server" />
		<property name="statusObjectService" ref="statusObjectService" />
		<property name="globalScopeConnectionAllowed" value="true" />
	</bean>
	
	<bean id="mrtmpManager"
		class="org.red5.server.net.mrtmp.SimpleMRTMPOriginManager" >
		<property name="originMRTMPHandler" ref="mrtmpMinaIoHandler" />
	</bean>
	
	<bean id="mrtmpCodecFactory"
		class="org.red5.server.net.mrtmp.codec.MRTMPCodecFactory" />
	
	<!-- MRTMP Mina IO Handler -->
	<bean id="mrtmpMinaIoHandler"
		class="org.red5.server.net.mrtmp.OriginMRTMPHandler">
		<property name="handler" ref="rtmpHandler" />
		<property name="mrtmpManager" ref="mrtmpManager" />
		<property name="codecFactory" ref="mrtmpCodecFactory" />
	</bean> 
	
	<!-- MRTMP Mina Transport -->
	<bean id="mrtmpTransport" class="org.red5.server.net.mrtmp.MRTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="mrtmpMinaIoHandler" />
		<property name="address" value="${mrtmp.host}" />
		<property name="port" value="${mrtmp.port}" />
		<property name="receiveBufferSize" value="${mrtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${mrtmp.send_buffer_size}" />
		<property name="eventThreadsCore" value="${mrtmp.event_threads_core}" />
		<property name="eventThreadsMax" value="${mrtmp.event_threads_max}" />
		<property name="eventThreadsQueue" value="${mrtmp.event_threads_queue}" />
		<property name="eventThreadsKeepalive" value="${mrtmp.event_threads_keepalive}" />
		<property name="tcpNoDelay" value="${mrtmp.tcp_nodelay}" />
	</bean> 
	
	<!-- Uncomment this if you run Origin on a different server from Edge
	     and still want to use RTMP 
	<bean id="rtmpConnManager"
		class="org.red5.server.net.rtmp.RTMPConnManager">
	</bean>
	
	<bean id="rtmpMinaIoHandler"
		class="org.red5.server.net.rtmp.RTMPMinaIoHandler">
		<property name="handler" ref="rtmpHandler" />
		<property name="codecFactory" ref="rtmpCodecFactory" />
		<property name="rtmpConnManager" ref="rtmpConnManager" />
	</bean>
	
	<bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="rtmpMinaIoHandler" />
		<property name="address" value="${rtmp.host}" />
		<property name="port" value="${rtmp.port}" />
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="eventThreadsCore" value="${rtmp.event_threads_core}" />
		<property name="eventThreadsMax" value="${rtmp.event_threads_max}" />
		<property name="eventThreadsQueue" value="${rtmp.event_threads_queue}" />
		<property name="eventThreadsKeepalive" value="${rtmp.event_threads_keepalive}" />
		<property name="jmxPollInterval" value="1000" />
		<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
	</bean>
	
	<bean id="rtmpMinaConnection" scope="prototype"
		class="org.red5.server.net.rtmp.RTMPMinaConnection">
		<property name="pingInterval" value="${rtmp.ping_interval}" />
		<property name="maxInactivity" value="${rtmp.max_inactivity}" />
		<property name="maxHandshakeTimeout" value="5000" />
	</bean>
	-->

	<bean id="rtmpMinaConnManager"
		class="org.red5.server.net.rtmp.RTMPConnManager">
	</bean>

	<bean id="rtmpMinaIoHandler"
		class="org.red5.server.net.rtmp.RTMPMinaIoHandler">
		<property name="handler" ref="rtmpHandler" />
		<property name="codecFactory" ref="rtmpCodecFactory" />
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<!-- RTMP Mina Transport -->
	<bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="rtmpMinaIoHandler" />
        <property name="connectors">
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg index="0" type="java.lang.String" value="${rtmp.host}" />  
                    <constructor-arg index="1" type="int" value="${rtmp.port}" />  
                </bean>
                <!-- You can now add additional ports and ip addresses
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg index="0" type="java.lang.String" value="${rtmp.host}" />  
                    <constructor-arg index="1" type="int" value="1936" />  
                </bean>
                 -->
            </list>
        </property>
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="connectionThreads" value="${rtmp.connect_threads}" />
		<property name="ioThreads" value="${rtmp.io_threads}" />
		<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
				enabled, polling will not occur. -->
		<property name="jmxPollInterval" value="1000" />
		<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
	</bean>
	
	<!-- RTMP Mina Connection -->
	<bean id="rtmpMinaConnection" scope="prototype"	class="org.red5.server.net.rtmp.RTMPMinaConnection">
		<!-- Ping clients every X ms. Set to 0 to disable ghost detection code. -->
		<property name="pingInterval" value="${rtmp.ping_interval}" />
		<!-- Disconnect client after X ms of not responding. -->
		<property name="maxInactivity" value="${rtmp.max_inactivity}" />
		<!-- Max. time in milliseconds to wait for a valid handshake. -->
		<property name="maxHandshakeTimeout" value="5000" />
	</bean>
	
	<!--
	 + The following configuration is for RTMPT.
	 -->
	<bean id="rtmptConnManager"
		class="org.red5.server.net.rtmp.RTMPConnManager">
	</bean>
	
	<!-- RTMPT Handler -->
	<bean id="rtmptHandler"
		class="org.red5.server.net.rtmpt.RTMPTHandler" autowire="byType">
		<property name="codecFactory" ref="rtmptCodecFactory" />
	</bean>
	
	<!-- Use injection to store RTMPT handler in servlet -->
	<bean id="rtmptServlet"
		class="org.red5.server.net.rtmpt.RTMPTServlet">
		<property name="handler" ref="rtmptHandler" />
		<property name="rtmpConnManager" ref="rtmptConnManager" />
	</bean>
	
	<!-- RTMPT Connection -->
	<bean id="rtmptConnection" scope="prototype"
		class="org.red5.server.net.rtmpt.RTMPTConnection">
		<!-- Ping clients every X ms. Set to 0 to disable ghost detection code. -->
		<property name="pingInterval" value="${rtmp.ping_interval}" />
		<!-- Disconnect client after X ms of not responding. -->
		<property name="maxInactivity" value="${rtmp.max_inactivity}" />
		<!-- Max. time in milliseconds to wait for a valid handshake. -->
		<property name="maxHandshakeTimeout" value="5000" />
	</bean>
	
	<!-- Jetty RTMPT Container -->
	<!-- 
	<bean id="rtmpt.server"
		class="org.red5.server.net.rtmpt.RTMPTLoader" init-method="init"
		autowire="byType" />
	-->	
	<!-- Tomcat Container -->
	<!-- 
	<bean id="rtmpt.server" class="org.red5.server.net.rtmpt.TomcatRTMPTLoader" init-method="init" lazy-init="true">
	
		<property name="webappFolder" value="${red5.root}/webapps" />
		
		<property name="connector">
			<bean class="org.apache.catalina.connector.Connector">
				<constructor-arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />	
				<property name="port"><value>${rtmpt.port}</value></property>
				<property name="enableLookups"><value>false</value></property>
			</bean>
		</property>
		
		<property name="host">
			<bean class="org.apache.catalina.core.StandardHost">
				<property name="name" value="${rtmpt.host}" />
				<property name="unpackWARs" value="false" />
				<property name="autoDeploy" value="false" />
				<property name="xmlValidation" value="false" />
				<property name="xmlNamespaceAware" value="false" />
			</bean>	   
		</property>		

	</bean>
	-->

	<bean id="rtmpt.server" class="org.red5.server.tomcat.rtmpt.RTMPTLoader" init-method="init" lazy-init="true">
	
		<property name="webappFolder" value="${red5.root}/webapps" />
		
		<property name="connector">
			<bean class="org.apache.catalina.connector.Connector">
				<constructor-arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />	
				<property name="port"><value>${rtmpt.port}</value></property>
				<property name="enableLookups"><value>false</value></property>
			</bean>
		</property>

		<property name="connectionProperties">
			<map>
				<entry key="maxKeepAliveRequests" value="${rtmpt.max_keep_alive_requests}"/>
				<entry key="useExecutor" value="true"/>
				<entry key="maxThreads" value="${rtmpt.max_threads}"/>
				<entry key="acceptorThreadCount" value="${rtmpt.acceptor_thread_count}"/>
				<entry key="processorCache" value="${rtmpt.processor_cache}"/>
			</map>
		</property>
		
		<property name="host">
			<bean class="org.apache.catalina.core.StandardHost">
				<property name="name" value="${rtmpt.host}" />
				<property name="unpackWARs" value="false" />
				<property name="autoDeploy" value="false" />
				<property name="xmlValidation" value="false" />
				<property name="xmlNamespaceAware" value="false" />
			</bean>	   
		</property>		

	</bean>

	
	<!--  
		<bean id="rtmpt.server" class="org.red5.server.net.rtmpt.TomcatRTMPTLoader" init-method="init" autowire="byType">
		<property name="embedded">
		<bean class="org.apache.catalina.startup.Embedded" />
		</property>
		
		<property name="engine">
		<bean class="org.apache.catalina.core.StandardEngine">
		<property name="name" value="rtmptServletHandler" />
		<property name="defaultHost" value="localhost" />
		</bean>	  
		</property>
		
		<property name="connector">
		<bean class="org.apache.catalina.connector.Connector">
		<property name="port"><value>8088</value></property>
		<property name="enableLookups"><value>false</value></property>
		</bean>
		</property>
		
		<property name="host">
		<bean class="org.apache.catalina.core.StandardHost">
		<property name="name" value="localhost" />
		<property name="unpackWARs" value="false" />
		<property name="autoDeploy" value="false" />
		<property name="xmlValidation" value="false" />
		<property name="xmlNamespaceAware" value="false" />
		</bean>	   
		</property>		
		
		<property name="context">
		<map>
		<entry>
		<key><value>name</value></key>
		<value>rtmptContext</value>
		</entry>
		<entry>
		<key><value>path</value></key>
		<value></value>
		</entry>
		<entry>
		<key><value>docBase</value></key>
		<value>/</value>
		</entry>		
		</map>			
		</property>	    
		
		<property name="wrapper">
		<bean class="org.apache.catalina.core.StandardWrapper">
		<property name="servletName" value="RTMPTServlet" />
		<property name="servletClass" value="org.red5.server.net.servlet.RTMPTServlet" />
		</bean>	    
		</property>	    
		
		<property name="mappings">
		<map>
		<entry>
		<key><value>RTMPTServlet</value></key>
		<value>/open/*</value>
		</entry>
		<entry>
		<key><value>RTMPTServlet</value></key>
		<value>/close/*</value>
		</entry>
		<entry>
		<key><value>RTMPTServlet</value></key>
		<value>/send/*</value>
		</entry>
		<entry>
		<key><value>RTMPTServlet</value></key>
		<value>/idle/*</value>
		</entry>		      
		</map>
		</property>
		</bean>
	-->
	
	<!-- RTMPS -->
	<!-- 
	<bean id="rtmps.server" class="org.red5.server.net.rtmps.TomcatRTMPSLoader" init-method="init" lazy-init="true">
	
		<property name="webappFolder" value="${red5.root}/webapps" />
		
		<property name="connector">
			<bean class="org.apache.catalina.connector.Connector">
				<constructor-arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />			
				<property name="port" value="${rtmps.port}" />
				<property name="redirectPort" value="${rtmp.port}" />
			</bean>			
		</property>	
		
		<property name="host">
			<bean class="org.apache.catalina.core.StandardHost">
				<property name="name" value="${rtmps.host}" />
				<property name="unpackWARs" value="false" />
				<property name="autoDeploy" value="false" />
				<property name="xmlValidation" value="false" />
				<property name="xmlNamespaceAware" value="false" />
			</bean>	   
		</property>		
	
		<property name="connectionProperties">
			<map>
				<entry>
					<key><value>SSLEnabled</value></key>
					<value>true</value>
				</entry>
				<entry>
					<key><value>sslProtocol</value></key>
					<value>TLS</value>
				</entry>
				<entry>
					<key><value>clientAuth</value></key>
					<value>false</value>
				</entry>
				<entry>
					<key><value>keystoreFile</value></key>
					<value>conf/keystore</value>
				</entry>
				<entry>
					<key><value>keystorePass</value></key>
					<value>${rtmps.keystorepass}</value>
				</entry>
				<entry>
					<key><value>keystoreType</value></key>
					<value>JKS</value>
				</entry>
			</map>
		</property>	

		<property name="valves">
      		<list>
	    		<bean id="valve.access" class="org.apache.catalina.valves.AccessLogValve">
	                <property name="directory" value="log" />
	                <property name="prefix" value="${rtmps.host}_rtmps_access." />
	                <property name="suffix" value=".log" />
	                <property name="pattern" value="common" />
	                <property name="resolveHosts" value="false" />
	                <property name="rotatable" value="true" />
	        	</bean>
        	</list>
        </property>			
	
	</bean>	 
	-->
</beans>

 

二、边服务器的主要配置

 

conf/red5.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:lang="http://www.springframework.org/schema/lang"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                           http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">

	<!-- This file just wires together the context tree. Its accessed by ContextSingletonBeanFactoryLocator -->
	
	<bean id="placeholderConfig"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:/red5.properties" />
	</bean>

	<!-- First we load the common context, its shared between all the other contexts -->
	<!-- Global context serves are the parent to all child contexts. -->
	<bean id="red5.common"
  	    class="org.springframework.context.support.FileSystemXmlApplicationContext">
    	<constructor-arg><list><value>classpath:/red5-common.xml</value></list></constructor-arg>
	</bean>
	
	<!-- Then we load the core context, with the common as parent --> 
	<!-- Context holding all the networking, users should need to edit. -->
	<bean id="red5.core"
  	    class="org.springframework.context.support.FileSystemXmlApplicationContext">
    	<constructor-arg><list><value>classpath:/red5-edge-core.xml</value></list></constructor-arg>
    	<constructor-arg><ref bean="red5.common" /></constructor-arg>
	</bean>

	<!-- Then we load the global contexts, note its important this happens before app container loads -->
	<bean id="context.loader" 
		class="org.red5.server.ContextLoader"
		init-method="init">
		<property name="parentContext" ref="red5.common" />
		<property name="contextsConfig" value="classpath:red5.globals" />
	</bean>	
</beans>

 

conf/red5-edge-core.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:lang="http://www.springframework.org/schema/lang"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd                            
	http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
	<!-- This context holds all the networking: mina -->

	<bean id="customEditorConfigurer"
		class="org.springframework.beans.factory.config.CustomEditorConfigurer">
		<property name="customEditors">
			<map>
				<entry key="java.net.SocketAddress">
					<bean
						class="org.apache.mina.integration.beans.InetSocketAddressEditor" />
				</entry>
			</map>
		</property>
	</bean>
	
	<bean id="placeholderConfig"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:/red5.properties" />
	</bean>

	<!-- RTMP Handler -->
	<bean id="rtmpHandler"
		class="org.red5.server.net.rtmp.EdgeRTMPHandler">
		<property name="server" ref="red5.server" />
		<property name="statusObjectService" ref="statusObjectService" />
		<property name="MRTMPManager" ref="mrtmpEdgeManager" />
	</bean>
	
	<bean id="rtmpMinaConnManager"
		class="org.red5.server.net.rtmp.RTMPConnManager">
	</bean>
	
	<!-- RTMP Mina IO Handler -->
	<bean id="rtmpMinaIoHandler"
		class="org.red5.server.net.rtmp.EdgeRTMPMinaIoHandler">
		<property name="handler" ref="rtmpHandler" />
		<property name="codecFactory" ref="rtmpCodecFactory" />
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<!-- RTMP Mina Transport -->
	<!-- <bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="rtmpMinaIoHandler" />
		<property name="address" value="${rtmp.host}" />
		<property name="port" value="${rtmp.port}" />
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="eventThreadsCore" value="${rtmp.event_threads_core}" />
		<property name="eventThreadsMax" value="${rtmp.event_threads_max}" />
		<property name="eventThreadsQueue" value="${rtmp.event_threads_queue}" />
		<property name="eventThreadsKeepalive" value="${rtmp.event_threads_keepalive}" /> -->
		<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
				enabled, polling will not occur. -->
	<!-- 	<property name="jmxPollInterval" value="1000" />
		<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
	</bean> -->

	<bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="rtmpMinaIoHandler" />
        <property name="connectors">
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg index="0" type="java.lang.String" value="${rtmp.host}" />  
                    <constructor-arg index="1" type="int" value="${rtmp.port}" />  
                </bean>
                <!-- You can now add additional ports and ip addresses
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg index="0" type="java.lang.String" value="${rtmp.host}" />  
                    <constructor-arg index="1" type="int" value="1936" />  
                </bean>
                 -->
            </list>
        </property>
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="connectionThreads" value="${rtmp.connect_threads}" />
		<property name="ioThreads" value="${rtmp.io_threads}" />
		<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
				enabled, polling will not occur. -->
		<property name="jmxPollInterval" value="1000" />
		<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
	</bean>
	
	<!-- RTMP Mina Connection -->
	<bean id="rtmpEdgeMinaConnection" scope="prototype"
		class="org.red5.server.net.rtmp.EdgeRTMPMinaConnection">
		<!-- Ping clients every X ms. Set to 0 to disable ghost detection code. -->
		<property name="pingInterval" value="${rtmp.ping_interval}" />
		<!-- Disconnect client after X ms of not responding. -->
		<property name="maxInactivity" value="${rtmp.max_inactivity}" />
		<!-- Max. time in milliseconds to wait for a valid handshake. -->
		<property name="maxHandshakeTimeout" value="5000" />
		<property name="mrtmpManager" ref="mrtmpEdgeManager" />
	</bean>
	
	<bean id="mrtmpCodecFactory"
		class="org.red5.server.net.mrtmp.codec.MRTMPCodecFactory" />
	
	<bean id="mrtmpHandler" class="org.red5.server.net.mrtmp.EdgeMRTMPHandler">
		<property name="mrtmpManager" ref="mrtmpEdgeManager"/>
		<property name="codecFactory" ref="mrtmpCodecFactory" />
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<bean id="mrtmpClient"
		class="org.red5.server.net.mrtmp.MRTMPClient" init-method="start" >
		<property name="ioHandler" ref="mrtmpHandler" />
		<property name="server" value="${mrtmp.server}" />
		<property name="port" value="${mrtmp.port}" />
	</bean>
	
	<bean id="mrtmpEdgeManager"
		class="org.red5.server.net.mrtmp.SimpleMRTMPEdgeManager">
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<!-- Enable when you need it.
	<bean id="rtmpProxyTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="debugProxyIoHandler" />
		<property name="address" value="${proxy.source_host}" />
		<property name="port" value="${proxy.source_port}" />
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="eventThreadsCore" value="${rtmp.event_threads_core}" />
		<property name="eventThreadsMax" value="${rtmp.event_threads_max}" />
		<property name="eventThreadsQueue" value="${rtmp.event_threads_queue}" />
		<property name="eventThreadsKeepalive" value="${rtmp.event_threads_keepalive}" />
	</bean>
    
	<bean id="debugProxyIoHandler"
		class="org.red5.server.net.proxy.DebugProxyHandler">
		<property name="codecFactory" ref="rtmpCodecFactory" />
		<property name="forward" value="${proxy.destination_host}:${proxy.destination_port}" />
		<property name="dumpTo" value="./webapps/dump/" />
	</bean>
	-->
</beans>

 

你可能感兴趣的:(服务器)