mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	support h264/avc codec by rtmp complex handshake(SrsComplexHandshake)
This commit is contained in:
		
							parent
							
								
									f0f4837a97
								
							
						
					
					
						commit
						53a668e34d
					
				
					 8 changed files with 1031 additions and 29 deletions
				
			
		
							
								
								
									
										2
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -105,7 +105,7 @@ MAIN_ENTRANCES=("srs_main_server")
 | 
			
		|||
# srs(simple rtmp server) over st(state-threads)
 | 
			
		||||
ModuleLibFiles=(${LibSTfile})
 | 
			
		||||
MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
 | 
			
		||||
BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" LINK_OPTIONS="-ldl" SO_PATH="" . auto/apps.sh
 | 
			
		||||
BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" LINK_OPTIONS="-ldl -lssl" SO_PATH="" . auto/apps.sh
 | 
			
		||||
 | 
			
		||||
echo 'configure ok! '
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
* Annex E. The FLV File Format
 | 
			
		||||
* @doc update the README.cmd
 | 
			
		||||
*/
 | 
			
		||||
class SrsCodec
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -36,6 +36,7 @@ class SrsSocket;
 | 
			
		|||
* rtmp complex handshake,
 | 
			
		||||
* @see also crtmp(crtmpserver) or librtmp,
 | 
			
		||||
* @see also: http://blog.csdn.net/win_lin/article/details/13006803
 | 
			
		||||
* @doc update the README.cmd
 | 
			
		||||
*/
 | 
			
		||||
class SrsComplexHandshake
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,10 +63,39 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		|||
#define ERROR_RTMP_AMF0_ENCODE			309
 | 
			
		||||
#define ERROR_RTMP_CHUNK_SIZE			310
 | 
			
		||||
#define ERROR_RTMP_TRY_SIMPLE_HS		311
 | 
			
		||||
#define ERROR_RTMP_CH_SCHEMA			312
 | 
			
		||||
 | 
			
		||||
#define ERROR_SYSTEM_STREAM_INIT		400
 | 
			
		||||
#define ERROR_SYSTEM_PACKET_INVALID		401
 | 
			
		||||
#define ERROR_SYSTEM_CLIENT_INVALID		402
 | 
			
		||||
#define ERROR_SYSTEM_ASSERT_FAILED		403
 | 
			
		||||
 | 
			
		||||
// see librtmp.
 | 
			
		||||
// failed when open ssl create the dh
 | 
			
		||||
#define ERROR_OpenSslCreateDH			500
 | 
			
		||||
// failed when open ssl create the Private key.
 | 
			
		||||
#define ERROR_OpenSslCreateP			501
 | 
			
		||||
// when open ssl create G.
 | 
			
		||||
#define ERROR_OpenSslCreateG			502
 | 
			
		||||
// when open ssl parse P1024
 | 
			
		||||
#define ERROR_OpenSslParseP1024			503
 | 
			
		||||
// when open ssl set G
 | 
			
		||||
#define ERROR_OpenSslSetG				504
 | 
			
		||||
// when open ssl generate DHKeys
 | 
			
		||||
#define ERROR_OpenSslGenerateDHKeys		505
 | 
			
		||||
// when open ssl share key already computed.
 | 
			
		||||
#define ERROR_OpenSslShareKeyComputed	506
 | 
			
		||||
// when open ssl get shared key size.
 | 
			
		||||
#define ERROR_OpenSslGetSharedKeySize	507
 | 
			
		||||
// when open ssl get peer public key.
 | 
			
		||||
#define ERROR_OpenSslGetPeerPublicKey	508
 | 
			
		||||
// when open ssl compute shared key.
 | 
			
		||||
#define ERROR_OpenSslComputeSharedKey	509
 | 
			
		||||
// when open ssl is invalid DH state.
 | 
			
		||||
#define ERROR_OpenSslInvalidDHState		510
 | 
			
		||||
// when open ssl copy key
 | 
			
		||||
#define ERROR_OpenSslCopyKey			511
 | 
			
		||||
// when open ssl sha256 digest key invalid size.
 | 
			
		||||
#define ERROR_OpenSslSha256DigestSize	512
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -345,6 +345,7 @@ public:
 | 
			
		|||
* shared ptr message.
 | 
			
		||||
* for audio/video/data message that need less memory copy.
 | 
			
		||||
* and only for output.
 | 
			
		||||
* @doc update the README.cmd
 | 
			
		||||
*/
 | 
			
		||||
class SrsSharedPtrMessage : public ISrsMessage
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,18 +210,18 @@ int SrsRtmp::handshake()
 | 
			
		|||
	// plain text required.
 | 
			
		||||
    s0s1s2[0] = 0x03;
 | 
			
		||||
    if ((ret = skt.write(s0s1s2, 3073, &nsize)) != ERROR_SUCCESS) {
 | 
			
		||||
        srs_warn("send s0s1s2 failed. ret=%d", ret);
 | 
			
		||||
        srs_warn("simple handshake send s0s1s2 failed. ret=%d", ret);
 | 
			
		||||
        return ret;
 | 
			
		||||
    }
 | 
			
		||||
    srs_verbose("send s0s1s2 success.");
 | 
			
		||||
    srs_verbose("simple handshake send s0s1s2 success.");
 | 
			
		||||
    
 | 
			
		||||
    char* c2 = new char[1536];
 | 
			
		||||
    SrsAutoFree(char, c2, true);
 | 
			
		||||
    if ((ret = skt.read_fully(c2, 1536, &nsize)) != ERROR_SUCCESS) {
 | 
			
		||||
        srs_warn("read c2 failed. ret=%d", ret);
 | 
			
		||||
        srs_warn("simple handshake read c2 failed. ret=%d", ret);
 | 
			
		||||
        return ret;
 | 
			
		||||
    }
 | 
			
		||||
    srs_verbose("read c2 success.");
 | 
			
		||||
    srs_verbose("simple handshake read c2 success.");
 | 
			
		||||
    
 | 
			
		||||
    srs_trace("simple handshake success.");
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,6 +68,7 @@ public:
 | 
			
		|||
private:
 | 
			
		||||
	/**
 | 
			
		||||
	* detect the time jitter and correct it.
 | 
			
		||||
	* @doc update the README.cmd
 | 
			
		||||
	*/
 | 
			
		||||
	virtual int jitter_correct(SrsSharedPtrMessage* msg);
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue