[vlc-commits] avcodec: don't call mdate() so often in video decoding
Ilkka Ollakka
git at videolan.org
Wed Sep 7 11:16:43 CEST 2016
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Jun 4 13:36:33 2016 +0300| [0e473ea6e66a132dbd20d6f0a4f3be81c7a1aefd] | committer: Ilkka Ollakka
avcodec: don't call mdate() so often in video decoding
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0e473ea6e66a132dbd20d6f0a4f3be81c7a1aefd
---
modules/codec/avcodec/video.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 9349f75..5394b59 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -599,7 +599,7 @@ static bool check_block_validity( decoder_sys_t *p_sys, block_t *block )
return true;
}
-static bool check_block_being_late( decoder_sys_t *p_sys, block_t *block )
+static bool check_block_being_late( decoder_sys_t *p_sys, block_t *block, mtime_t current_time)
{
if( !block )
return false;
@@ -672,6 +672,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
block_t *p_block;
+ mtime_t current_time = VLC_TS_INVALID;
if( !p_context->extradata_size && p_dec->fmt_in.i_extra )
{
@@ -694,7 +695,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if( !check_block_validity( p_sys, p_block ) )
return NULL;
- if( p_dec->b_frame_drop_allowed && check_block_being_late( p_sys, p_block) )
+ current_time = mdate();
+ if( p_dec->b_frame_drop_allowed && check_block_being_late( p_sys, p_block, current_time) )
{
msg_Err( p_dec, "more than 5 seconds of late video -> "
"dropping frame (computer too slow ?)" );
@@ -872,15 +874,15 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
interpolate_next_pts( p_dec, frame );
/* Update frame late count (except when doing preroll) */
- mtime_t i_display_date = 0;
+ mtime_t i_display_date = VLC_TS_INVALID;
if( !p_block || !(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() )
+ if( i_display_date > VLC_TS_INVALID && i_display_date <= current_time )
{
p_sys->i_late_frames++;
if( p_sys->i_late_frames == 1 )
- p_sys->i_late_frames_start = mdate();
+ p_sys->i_late_frames_start = current_time;
}
else
{
More information about the vlc-commits
mailing list