@@ -438,17 +438,17 @@ ngx_rtmp_gop_cache_frame(ngx_rtmp_session_t *s, ngx_uint_t prio,
438438 // drop non-IDR
439439 if (prio != NGX_RTMP_VIDEO_KEY_FRAME && ctx -> cache_head == NULL ) {
440440 ngx_log_debug1 (NGX_LOG_DEBUG_RTMP , s -> connection -> log , 0 ,
441- "drop video non-keyframe timestamp=%uD" ,
441+ "gop cache: drop video non-keyframe timestamp=%uD" ,
442442 ch -> timestamp );
443443
444444 return ;
445445 }
446446 }
447447
448- // pure audio
448+ // audio only
449449 if (ctx -> video_frame_in_all == 0 && ch -> type == NGX_RTMP_MSG_AUDIO ) {
450450 ngx_log_debug1 (NGX_LOG_DEBUG_RTMP , s -> connection -> log , 0 ,
451- "drop audio frame timestamp=%uD" ,
451+ "gop cache: drop audio frame timestamp=%uD" ,
452452 ch -> timestamp );
453453
454454 return ;
@@ -461,23 +461,25 @@ ngx_rtmp_gop_cache_frame(ngx_rtmp_session_t *s, ngx_uint_t prio,
461461 }
462462
463463 // save video seq header.
464- if (ctx -> video_seq_header == NULL && codec_ctx -> avc_header ) {
464+ if (codec_ctx -> avc_header && ctx -> video_seq_header == NULL ) {
465465 ngx_log_debug0 (NGX_LOG_DEBUG_RTMP , s -> connection -> log , 0 ,
466- "video header comming" );
466+ "gop cache: video seq header is comming" );
467467 ctx -> video_seq_header = codec_ctx -> avc_header ;
468468 }
469469
470470 // save audio seq header.
471- if (ctx -> audio_seq_header == NULL && codec_ctx -> aac_header ) {
471+ if (codec_ctx -> aac_header && ctx -> audio_seq_header == NULL ) {
472472 ngx_log_debug0 (NGX_LOG_DEBUG_RTMP , s -> connection -> log , 0 ,
473- "audio header comming" );
473+ "gop cache: audio seq header is comming" );
474474 ctx -> audio_seq_header = codec_ctx -> aac_header ;
475475 }
476476
477477 // save metadata.
478- if (ctx -> meta == NULL && codec_ctx -> meta ) {
478+ if (codec_ctx -> meta &&
479+ (ctx -> meta == NULL || codec_ctx -> meta_version != ctx -> meta_version ))
480+ {
479481 ngx_log_debug0 (NGX_LOG_DEBUG_RTMP , s -> connection -> log , 0 ,
480- "meta comming" );
482+ "gop cache: meta is comming" );
481483 ctx -> meta_version = codec_ctx -> meta_version ;
482484 ctx -> meta = codec_ctx -> meta ;
483485 }
0 commit comments