@@ -501,7 +501,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
501
501
"%s"
502
502
"#EXTINF:%.3f,\n"
503
503
"%V%V%s%uL.ts\n" ,
504
- f -> discont ? "#EXT-X-DISCONTINUITY\n" : "" ,
504
+ /* f->discont ? "#EXT-X-DISCONTINUITY\n" :*/ "" ,
505
505
f -> duration , & hacf -> base_url , & name_part , sep , f -> id );
506
506
507
507
ngx_log_debug5 (NGX_LOG_DEBUG_RTMP , s -> connection -> log , 0 ,
@@ -1348,22 +1348,24 @@ ngx_rtmp_hls_update_fragment(ngx_rtmp_session_t *s, uint64_t ts,
1348
1348
ngx_msec_t ts_frag_len ;
1349
1349
ngx_int_t same_frag ;
1350
1350
ngx_buf_t * b ;
1351
+ int64_t d ;
1351
1352
1352
1353
hacf = ngx_rtmp_get_module_app_conf (s , ngx_rtmp_hls_module );
1353
-
1354
1354
ctx = ngx_rtmp_get_module_ctx (s , ngx_rtmp_hls_module );
1355
-
1356
1355
f = NULL ;
1357
1356
1358
1357
if (ctx -> opened ) {
1359
-
1360
1358
f = ngx_rtmp_hls_get_frag (s , ctx -> nfrags );
1361
- f -> duration = (ts - ctx -> frag_ts ) / 90000. ;
1359
+ d = (int64_t ) ( ts - ctx -> frag_ts );
1362
1360
1363
- if (f -> duration * 1000 > hacf -> max_fraglen ) {
1361
+ if (d > ( int64_t ) hacf -> max_fraglen * 90 || d < -90000 ) {
1364
1362
ngx_log_error (NGX_LOG_ERR , s -> connection -> log , 0 ,
1365
- "hls: max fragment length reached" );
1363
+ "hls: max fragment length reached: %.3f sec, " ,
1364
+ f -> duration );
1366
1365
boundary = 1 ;
1366
+
1367
+ } else {
1368
+ f -> duration = (ts - ctx -> frag_ts ) / 90000. ;
1367
1369
}
1368
1370
}
1369
1371
0 commit comments