@@ -30,6 +30,8 @@ static ngx_int_t
30
30
ngx_hls_live_write_frame (ngx_rtmp_session_t * s , ngx_mpegts_frame_t * frame );
31
31
static void
32
32
ngx_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 );
33
35
34
36
static ngx_mpegts_video_pt next_mpegts_video ;
35
37
static 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,
263
265
m3u8 .data = out -> pos ;
264
266
m3u8 .len = out -> last - out -> pos ;
265
267
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" ,
267
269
& m3u8 , ctx -> last_time );
268
270
269
271
return NGX_OK ;
@@ -377,7 +379,8 @@ ngx_hls_live_prepare_frag(ngx_rtmp_session_t *s, ngx_hls_live_frag_t *frag)
377
379
frame = frag -> content [frag -> content_pos ];
378
380
379
381
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 ,
381
384
frame );
382
385
for (cl = frame -> chain ; cl ; cl = cl -> next ) {
383
386
* ll = ngx_get_chainbuf (0 , 0 );
@@ -748,6 +751,7 @@ ngx_hls_live_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
748
751
{
749
752
ngx_hls_live_app_conf_t * hacf ;
750
753
ngx_hls_live_ctx_t * ctx ;
754
+ // ngx_rtmp_codec_ctx_t *codec_ctx;
751
755
752
756
hacf = ngx_rtmp_get_module_app_conf (s , ngx_hls_live_module );
753
757
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)
767
771
ctx -> sid .len = ngx_strlen (v -> session );
768
772
ctx -> sid .data = ngx_pcalloc (s -> pool , ctx -> sid .len );
769
773
ngx_memcpy (ctx -> sid .data , v -> session , ctx -> sid .len );
774
+ /*
775
+ if (s->live_stream->publish_ctx) {
770
776
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
+ */
771
785
next :
772
786
return next_play (s , v );
773
787
}
@@ -925,13 +939,9 @@ ngx_hls_live_update(ngx_rtmp_session_t *s, ngx_rtmp_codec_ctx_t *codec_ctx)
925
939
926
940
while (s -> out_pos != s -> out_last ) {
927
941
928
- if (s -> out_pos == s -> out_last ) {
929
- break ;
930
- }
931
-
932
942
frame = s -> mpegts_out [s -> out_pos ];
933
943
#if 1
934
- ngx_log_error (NGX_LOG_DEBUG , s -> log , 0 ,
944
+ ngx_log_error (NGX_LOG_INFO , s -> log , 0 ,
935
945
"hls-live: update| "
936
946
"frame[%p] pos[%O] last[%O] pts[%uL] type [%d], key %d, opened %d" ,
937
947
frame , s -> out_pos , s -> out_last ,frame -> pts ,
0 commit comments