mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	refine code, rename the c0c3 header cache and iov cache.
This commit is contained in:
		
							parent
							
								
									ab93506b01
								
							
						
					
					
						commit
						953159258c
					
				
					 2 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -564,21 +564,21 @@ int SrsProtocol::do_send_message(SrsMessage* msg)
 | 
			
		|||
        srs_assert(nbh > 0);
 | 
			
		||||
        
 | 
			
		||||
        // header iov
 | 
			
		||||
        iov[0].iov_base = header;
 | 
			
		||||
        iov[0].iov_len = nbh;
 | 
			
		||||
        out_iov[0].iov_base = header;
 | 
			
		||||
        out_iov[0].iov_len = nbh;
 | 
			
		||||
        
 | 
			
		||||
        // payload iov
 | 
			
		||||
        int payload_size = pend - p;
 | 
			
		||||
        if (payload_size > out_chunk_size) {
 | 
			
		||||
            payload_size = out_chunk_size;
 | 
			
		||||
        }
 | 
			
		||||
        iov[1].iov_base = p;
 | 
			
		||||
        iov[1].iov_len = payload_size;
 | 
			
		||||
        out_iov[1].iov_base = p;
 | 
			
		||||
        out_iov[1].iov_len = payload_size;
 | 
			
		||||
        
 | 
			
		||||
        // send by writev
 | 
			
		||||
        // sendout header and payload by writev.
 | 
			
		||||
        // decrease the sys invoke count to get higher performance.
 | 
			
		||||
        if ((ret = skt->writev(iov, 2, NULL)) != ERROR_SUCCESS) {
 | 
			
		||||
        if ((ret = skt->writev(out_iov, 2, NULL)) != ERROR_SUCCESS) {
 | 
			
		||||
            srs_error("send with writev failed. ret=%d", ret);
 | 
			
		||||
            return ret;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -592,7 +592,7 @@ int SrsProtocol::do_send_message(SrsMessage* msg)
 | 
			
		|||
 | 
			
		||||
void SrsProtocol::generate_chunk_header(SrsMessageHeader* mh, bool c0, int* pnbh, char** ph) 
 | 
			
		||||
{
 | 
			
		||||
    char* cache = out_c0_cache;
 | 
			
		||||
    char* cache = out_c0c3_cache;
 | 
			
		||||
    
 | 
			
		||||
    // to directly set the field.
 | 
			
		||||
    char* pp = NULL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -215,11 +215,11 @@ private:
 | 
			
		|||
    * used for type0, 11bytes(or 15bytes with extended timestamp) header.
 | 
			
		||||
    * or for type3, 1bytes(or 5bytes with extended timestamp) header.
 | 
			
		||||
    */
 | 
			
		||||
    char out_c0_cache[SRS_CONSTS_RTMP_MAX_FMT0_HEADER_SIZE];
 | 
			
		||||
    char out_c0c3_cache[SRS_CONSTS_RTMP_MAX_FMT0_HEADER_SIZE];
 | 
			
		||||
    /**
 | 
			
		||||
    * output iovec cache.
 | 
			
		||||
    */
 | 
			
		||||
    iovec iov[2];
 | 
			
		||||
    iovec out_iov[2];
 | 
			
		||||
    /**
 | 
			
		||||
    * output chunk size, default to 128, set by config.
 | 
			
		||||
    */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue