avformat/hlsenc: process hls_time value too small sence
The target duration will be a negative value when there are some b frames after prevous frame, the pts after current packet is large than the pts of current packet, so the target duration will compute as 0.040000 - 0.080000, then the value of the target duration will be -0.040000. so hls muxer should check the pts after current packet minus the pts of current packet, hls muxer can split the stream as a segment if the target duration is neither negative nor zero, hls muxer cannot split the stream as a segment if the target duration is either negative or zero then get the next packet until the target duration is not negative or zero. Signed-off-by: Steven Liu <lq@chinaffmpeg.org> Suggested-by: Zhili Zhao <quinkblack@foxmail.com> Signed-off-by: liuqi05 <liuqi05@kuaishou.com>
This commit is contained in:
		
							parent
							
								
									2134667227
								
							
						
					
					
						commit
						a424671e4f
					
				@ -2398,9 +2398,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
 | 
				
			|||||||
                vs->duration = (double)(pkt->pts - vs->end_pts) * st->time_base.num / st->time_base.den;
 | 
					                vs->duration = (double)(pkt->pts - vs->end_pts) * st->time_base.num / st->time_base.den;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    can_split = can_split && (pkt->pts - vs->end_pts > 0);
 | 
				
			||||||
    if (vs->packets_written && can_split && av_compare_ts(pkt->pts - vs->start_pts, st->time_base,
 | 
					    if (vs->packets_written && can_split && av_compare_ts(pkt->pts - vs->start_pts, st->time_base,
 | 
				
			||||||
                                                          end_pts, AV_TIME_BASE_Q) >= 0) {
 | 
					                                                          end_pts, AV_TIME_BASE_Q) >= 0) {
 | 
				
			||||||
        int64_t new_start_pos;
 | 
					        int64_t new_start_pos;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user