ffplay: add smarter method for determining video picture duration
- consider it an invalid PTS when the next PTS value is the same as the current one - in case of invalid or unknown PTS, return vp->duration This fixes ffplay part of ticket #3005. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
		
							parent
							
								
									61dd319770
								
							
						
					
					
						commit
						5ecfcc7dff
					
				
							
								
								
									
										14
									
								
								ffplay.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ffplay.c
									
									
									
									
									
								
							@ -1293,6 +1293,18 @@ static double compute_target_delay(double delay, VideoState *is)
 | 
				
			|||||||
    return delay;
 | 
					    return delay;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static double vp_duration(VideoState *is, VideoPicture *vp, VideoPicture *nextvp) {
 | 
				
			||||||
 | 
					    if (vp->serial == nextvp->serial) {
 | 
				
			||||||
 | 
					        double duration = nextvp->pts - vp->pts;
 | 
				
			||||||
 | 
					        if (isnan(duration) || duration <= 0 || duration > is->max_frame_duration)
 | 
				
			||||||
 | 
					            return vp->duration;
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            return duration;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return 0.0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void pictq_next_picture(VideoState *is) {
 | 
					static void pictq_next_picture(VideoState *is) {
 | 
				
			||||||
    /* update queue size and signal for next picture */
 | 
					    /* update queue size and signal for next picture */
 | 
				
			||||||
    if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
 | 
					    if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
 | 
				
			||||||
@ -1407,7 +1419,7 @@ retry:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (is->pictq_size > 1) {
 | 
					            if (is->pictq_size > 1) {
 | 
				
			||||||
                VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE];
 | 
					                VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE];
 | 
				
			||||||
                duration = nextvp->pts - vp->pts;
 | 
					                duration = vp_duration(is, vp, nextvp);
 | 
				
			||||||
                if(!is->step && (redisplay || framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){
 | 
					                if(!is->step && (redisplay || framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){
 | 
				
			||||||
                    if (!redisplay)
 | 
					                    if (!redisplay)
 | 
				
			||||||
                        is->frame_drops_late++;
 | 
					                        is->frame_drops_late++;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user