@@ -30,6 +30,8 @@ static ngx_int_t
3030ngx_hls_live_write_frame (ngx_rtmp_session_t * s , ngx_mpegts_frame_t * frame );
3131static void
3232ngx_hls_live_update_playlist (ngx_rtmp_session_t * s );
33+ static ngx_int_t
34+ ngx_hls_live_update (ngx_rtmp_session_t * s , ngx_rtmp_codec_ctx_t * codec_ctx );
3335
3436static ngx_mpegts_video_pt next_mpegts_video ;
3537static ngx_mpegts_audio_pt next_mpegts_audio ;
@@ -263,7 +265,7 @@ ngx_hls_live_write_playlist(ngx_rtmp_session_t *s, ngx_buf_t *out,
263265 m3u8 .data = out -> pos ;
264266 m3u8 .len = out -> last - out -> pos ;
265267
266- ngx_log_error (NGX_LOG_DEBUG , s -> log , 0 , "hls-live: playlist| %V, %D" ,
268+ ngx_log_error (NGX_LOG_INFO , s -> log , 0 , "hls-live: playlist| %V, %D" ,
267269 & m3u8 , ctx -> last_time );
268270
269271 return NGX_OK ;
@@ -377,7 +379,8 @@ ngx_hls_live_prepare_frag(ngx_rtmp_session_t *s, ngx_hls_live_frag_t *frag)
377379 frame = frag -> content [frag -> content_pos ];
378380
379381 ngx_log_error (NGX_LOG_DEBUG , s -> log , 0 , "hls-live: prepare_frag| "
380- "pos %D, last %D, frame chain %p" , frag -> content_pos , frag -> content_last ,
382+ "pos %D, last %D, frame chain %p" ,
383+ frag -> content_pos , frag -> content_last ,
381384 frame );
382385 for (cl = frame -> chain ; cl ; cl = cl -> next ) {
383386 * ll = ngx_get_chainbuf (0 , 0 );
@@ -748,6 +751,7 @@ ngx_hls_live_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
748751{
749752 ngx_hls_live_app_conf_t * hacf ;
750753 ngx_hls_live_ctx_t * ctx ;
754+ // ngx_rtmp_codec_ctx_t *codec_ctx;
751755
752756 hacf = ngx_rtmp_get_module_app_conf (s , ngx_hls_live_module );
753757 if (hacf == NULL || !hacf -> hls || s -> live_type != NGX_HLS_LIVE ) {
@@ -767,7 +771,17 @@ ngx_hls_live_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
767771 ctx -> sid .len = ngx_strlen (v -> session );
768772 ctx -> sid .data = ngx_pcalloc (s -> pool , ctx -> sid .len );
769773 ngx_memcpy (ctx -> sid .data , v -> session , ctx -> sid .len );
774+ /*
775+ if (s->live_stream->publish_ctx) {
770776
777+ codec_ctx = ngx_rtmp_get_module_ctx(s->live_stream->publish_ctx->session,
778+ ngx_rtmp_codec_module);
779+
780+ ngx_mpegts_gop_link(s->live_stream->publish_ctx->session,
781+ s, hacf->playlen, hacf->playlen);
782+ ngx_hls_live_update(s, codec_ctx);
783+ }
784+ */
771785next :
772786 return next_play (s , v );
773787}
@@ -925,13 +939,9 @@ ngx_hls_live_update(ngx_rtmp_session_t *s, ngx_rtmp_codec_ctx_t *codec_ctx)
925939
926940 while (s -> out_pos != s -> out_last ) {
927941
928- if (s -> out_pos == s -> out_last ) {
929- break ;
930- }
931- 932942 frame = s -> mpegts_out [s -> out_pos ];
933943#if 1
934- ngx_log_error (NGX_LOG_DEBUG , s -> log , 0 ,
944+ ngx_log_error (NGX_LOG_INFO , s -> log , 0 ,
935945 "hls-live: update| "
936946 "frame[%p] pos[%O] last[%O] pts[%uL] type [%d], key %d, opened %d" ,
937947 frame , s -> out_pos , s -> out_last ,frame -> pts ,
0 commit comments