@@ -445,16 +445,17 @@ static ngx_int_t
445
445
ngx_rtmp_record_node_open (ngx_rtmp_session_t * s ,
446
446
ngx_rtmp_record_rec_ctx_t * rctx )
447
447
{
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 ;
455
455
456
456
rracf = rctx -> conf ;
457
457
tag_size = 0 ;
458
+ p = buf ;
458
459
459
460
if (rctx -> file .fd != NGX_INVALID_FILE ) {
460
461
return NGX_AGAIN ;
@@ -540,27 +541,27 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
540
541
goto done ;
541
542
}
542
543
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 ) {
544
545
ngx_log_error (NGX_LOG_CRIT , s -> connection -> log , ngx_errno ,
545
546
"record: %V tag size read failed" , & rracf -> id );
546
547
goto done ;
547
548
}
548
549
549
- tag_size = ntohl (* (uint32_t * ) buf );
550
+ tag_size = ntohl (* (uint32_t * ) p );
550
551
551
552
if (tag_size == 0 || tag_size + 4 > file_size ) {
552
553
file_size = 0 ;
553
554
goto done ;
554
555
}
555
556
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 )
557
558
{
558
559
ngx_log_error (NGX_LOG_CRIT , s -> connection -> log , ngx_errno ,
559
560
"record: %V tag read failed" , & rracf -> id );
560
561
goto done ;
561
562
}
562
563
563
- mlen = ngx_rtmp_n3_to_h4 (buf + 1 );
564
+ mlen = ngx_rtmp_n3_to_h4 (p + 1 );
564
565
565
566
if (tag_size != mlen + 11 ) {
566
567
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,
569
570
goto done ;
570
571
}
571
572
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 );
574
575
575
576
done :
576
577
rctx -> file .offset = file_size ;
0 commit comments