@@ -445,16 +445,17 @@ static ngx_int_t
445445ngx_rtmp_record_node_open (ngx_rtmp_session_t * s ,
446446 ngx_rtmp_record_rec_ctx_t * rctx )
447447{
448- ngx_rtmp_record_app_conf_t * rracf ;
449- ngx_err_t err ;
450- ngx_str_t path ;
451- ngx_int_t mode , create_mode ;
452- u_char buf [8 ];
453- off_t file_size ;
454- uint32_t tag_size , mlen , timestamp ;
448+ ngx_rtmp_record_app_conf_t * rracf ;
449+ ngx_err_t err ;
450+ ngx_str_t path ;
451+ ngx_int_t mode , create_mode ;
452+ u_char * p , buf [8 ];
453+ off_t file_size ;
454+ uint32_t tag_size , mlen , timestamp ;
455455
456456 rracf = rctx -> conf ;
457457 tag_size = 0 ;
458+ p = buf ;
458459
459460 if (rctx -> file .fd != NGX_INVALID_FILE ) {
460461 return NGX_AGAIN ;
@@ -540,27 +541,27 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
540541 goto done ;
541542 }
542543
543- if (ngx_read_file (& rctx -> file , buf , 4 , file_size - 4 ) != 4 ) {
544+ if (ngx_read_file (& rctx -> file , p , 4 , file_size - 4 ) != 4 ) {
544545 ngx_log_error (NGX_LOG_CRIT , s -> connection -> log , ngx_errno ,
545546 "record: %V tag size read failed" , & rracf -> id );
546547 goto done ;
547548 }
548549
549- tag_size = ntohl (* (uint32_t * ) buf );
550+ tag_size = ntohl (* (uint32_t * ) p );
550551
551552 if (tag_size == 0 || tag_size + 4 > file_size ) {
552553 file_size = 0 ;
553554 goto done ;
554555 }
555556
556- if (ngx_read_file (& rctx -> file , buf , 8 , file_size - tag_size - 4 ) != 8 )
557+ if (ngx_read_file (& rctx -> file , p , 8 , file_size - tag_size - 4 ) != 8 )
557558 {
558559 ngx_log_error (NGX_LOG_CRIT , s -> connection -> log , ngx_errno ,
559560 "record: %V tag read failed" , & rracf -> id );
560561 goto done ;
561562 }
562563
563- mlen = ngx_rtmp_n3_to_h4 (buf + 1 );
564+ mlen = ngx_rtmp_n3_to_h4 (p + 1 );
564565
565566 if (tag_size != mlen + 11 ) {
566567 ngx_log_error (NGX_LOG_CRIT , s -> connection -> log , ngx_errno ,
@@ -569,8 +570,8 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
569570 goto done ;
570571 }
571572
572- timestamp = ngx_rtmp_n3_to_h4 (buf + 4 );
573- timestamp |= ((uint32_t ) buf [7 ] << 24 );
573+ timestamp = ngx_rtmp_n3_to_h4 (p + 4 );
574+ timestamp |= ((uint32_t ) p [7 ] << 24 );
574575
575576done :
576577 rctx -> file .offset = file_size ;
0 commit comments