the code from VLC :
vlc-2.0.8/modules/codec/avcodec/video.c
Code: Select all
/* Update frame late count (except when doing preroll) */
mtime_t i_display_date = 0;
if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
i_display_date = decoder_GetDisplayDate( p_dec, i_pts );
if( i_display_date > 0 && i_display_date <= mdate() )
{
p_sys->i_late_frames++;
if( p_sys->i_late_frames == 1 )
p_sys->i_late_frames_start = mdate();
}
else
{
p_sys->i_late_frames = 0;
}
I got a big problem when I use VLC 2.1.0-rc2 to play live H.264 stream that is output by ffserver.
the stream format is rtp. it includes Audio+ video. One rtp stream is for Audio and another is for Video.
The payload type is 96 for Video, and 97 for Audio.
Video format: H.264, 1280x720, 30fps.
Audio format: PCM_S16_LE, 2 channel, 48000 sample rate.
I see the error when VLC debug message is enabled.
"avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)"
then the video stream is freeze.
Because the frame rate is decrease if the light is dark when ffmpeg capture video data . Then the frame gap is larger than the first 10 minutes.
VLC does not know frame rate is decrease. VLC just know rtp timestamp has larger gap in the afterward packets.
How to to interpret "i_display_date" and "mdate()"?
What is the dependence between RTP timestamp and i_display_date and mdate?