mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	extract the rtmp connection
This commit is contained in:
		
							parent
							
								
									d8a64603c0
								
							
						
					
					
						commit
						973bea1e14
					
				
					 8 changed files with 94 additions and 12 deletions
				
			
		|  | @ -51,12 +51,6 @@ int SrsConnection::start() | |||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| int SrsConnection::do_cycle() | ||||
| { | ||||
| 	int ret = ERROR_SUCCESS; | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| void SrsConnection::cycle() | ||||
| { | ||||
| 	int ret = ERROR_SUCCESS; | ||||
|  |  | |||
|  | @ -43,8 +43,9 @@ public: | |||
| 	virtual ~SrsConnection(); | ||||
| public: | ||||
| 	virtual int start(); | ||||
| protected: | ||||
| 	virtual int do_cycle() = 0; | ||||
| private: | ||||
| 	virtual int do_cycle(); | ||||
| 	virtual void cycle(); | ||||
| 	static void* cycle_thread(void* arg); | ||||
| }; | ||||
|  |  | |||
							
								
								
									
										42
									
								
								trunk/src/core/srs_core_conn_rtmp.cpp
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								trunk/src/core/srs_core_conn_rtmp.cpp
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| /*
 | ||||
| The MIT License (MIT) | ||||
| 
 | ||||
| Copyright (c) 2013 winlin | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||||
| this software and associated documentation files (the "Software"), to deal in | ||||
| the Software without restriction, including without limitation the rights to | ||||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||||
| the Software, and to permit persons to whom the Software is furnished to do so, | ||||
| subject to the following conditions: | ||||
| 
 | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
| 
 | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||||
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||||
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
| */ | ||||
| 
 | ||||
| #include <srs_core_conn_rtmp.hpp> | ||||
| 
 | ||||
| #include <srs_core_error.hpp> | ||||
| 
 | ||||
| SrsRtmpConnection::SrsRtmpConnection(SrsServer* srs_server, st_netfd_t client_stfd) | ||||
| 	: SrsConnection(srs_server, client_stfd) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| SrsRtmpConnection::~SrsRtmpConnection() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| int SrsRtmpConnection::do_cycle() | ||||
| { | ||||
| 	int ret = ERROR_SUCCESS; | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										42
									
								
								trunk/src/core/srs_core_conn_rtmp.hpp
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								trunk/src/core/srs_core_conn_rtmp.hpp
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| /*
 | ||||
| The MIT License (MIT) | ||||
| 
 | ||||
| Copyright (c) 2013 winlin | ||||
| 
 | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||||
| this software and associated documentation files (the "Software"), to deal in | ||||
| the Software without restriction, including without limitation the rights to | ||||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||||
| the Software, and to permit persons to whom the Software is furnished to do so, | ||||
| subject to the following conditions: | ||||
| 
 | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
| 
 | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||||
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||||
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
| */ | ||||
| 
 | ||||
| #ifndef SRS_CORE_CONN_RTMP_HPP | ||||
| #define SRS_CORE_CONN_RTMP_HPP | ||||
| 
 | ||||
| /*
 | ||||
| #include <srs_core_conn_rtmp.hpp> | ||||
| */ | ||||
| 
 | ||||
| #include <srs_core_conn.hpp> | ||||
| 
 | ||||
| class SrsRtmpConnection : public SrsConnection | ||||
| { | ||||
| public: | ||||
| 	SrsRtmpConnection(SrsServer* srs_server, st_netfd_t client_stfd); | ||||
| 	virtual ~SrsRtmpConnection(); | ||||
| protected: | ||||
| 	virtual int do_cycle(); | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  | @ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| 
 | ||||
| #include <srs_core_log.hpp> | ||||
| #include <srs_core_error.hpp> | ||||
| #include <srs_core_conn.hpp> | ||||
| #include <srs_core_conn_rtmp.hpp> | ||||
| 
 | ||||
| #define SERVER_LISTEN_BACKLOG 10 | ||||
| 
 | ||||
|  | @ -135,6 +135,7 @@ int SrsServer::start(int port) | |||
| int SrsServer::cycle() | ||||
| { | ||||
| 	int ret = ERROR_SUCCESS; | ||||
| 	// TODO: canbe a api thread.
 | ||||
| 	st_thread_exit(NULL); | ||||
| 	return ret; | ||||
| } | ||||
|  | @ -156,7 +157,7 @@ int SrsServer::accept_client(st_netfd_t client_stfd) | |||
| { | ||||
| 	int ret = ERROR_SUCCESS; | ||||
| 	 | ||||
| 	SrsConnection* conn = new SrsConnection(this, client_stfd); | ||||
| 	SrsConnection* conn = new SrsRtmpConnection(this, client_stfd); | ||||
| 	 | ||||
| 	// directly enqueue, the cycle thread will remove the client.
 | ||||
| 	conns.push_back(conn); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue