Commit 153d58d2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: use unsigned stats

Inaccurate statistics are a lesser evil than undefined overflows.
parent eb5e41d9
...@@ -828,7 +828,7 @@ static void DecoderGetCc( decoder_t *p_dec, decoder_t *p_dec_cc ) ...@@ -828,7 +828,7 @@ static void DecoderGetCc( decoder_t *p_dec, decoder_t *p_dec_cc )
} }
static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture, static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
int *pi_lost_sum ) unsigned *restrict pi_lost_sum )
{ {
decoder_owner_sys_t *p_owner = p_dec->p_owner; decoder_owner_sys_t *p_owner = p_dec->p_owner;
vout_thread_t *p_vout = p_owner->p_vout; vout_thread_t *p_vout = p_owner->p_vout;
...@@ -926,12 +926,12 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture, ...@@ -926,12 +926,12 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
return 0; return 0;
} }
static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded, static void DecoderUpdateStatVideo( decoder_t *p_dec, unsigned decoded,
int lost ) unsigned lost )
{ {
decoder_owner_sys_t *p_owner = p_dec->p_owner; decoder_owner_sys_t *p_owner = p_dec->p_owner;
input_thread_t *p_input = p_owner->p_input; input_thread_t *p_input = p_owner->p_input;
int displayed = 0; unsigned displayed = 0;
/* Update ugly stat */ /* Update ugly stat */
if( p_input == NULL ) if( p_input == NULL )
...@@ -939,7 +939,7 @@ static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded, ...@@ -939,7 +939,7 @@ static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded,
if( p_owner->p_vout != NULL ) if( p_owner->p_vout != NULL )
{ {
int vout_lost = 0; unsigned vout_lost = 0;
vout_GetResetStatistic( p_owner->p_vout, &displayed, &vout_lost ); vout_GetResetStatistic( p_owner->p_vout, &displayed, &vout_lost );
lost += vout_lost; lost += vout_lost;
...@@ -955,7 +955,7 @@ static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded, ...@@ -955,7 +955,7 @@ static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded,
static int DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic ) static int DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
{ {
assert( p_pic ); assert( p_pic );
int i_lost = 0; unsigned i_lost = 0;
int ret = DecoderPlayVideo( p_dec, p_pic, &i_lost ); int ret = DecoderPlayVideo( p_dec, p_pic, &i_lost );
...@@ -967,8 +967,7 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block ) ...@@ -967,8 +967,7 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
{ {
picture_t *p_pic; picture_t *p_pic;
block_t **pp_block = p_block ? &p_block : NULL; block_t **pp_block = p_block ? &p_block : NULL;
int i_lost = 0; unsigned i_lost = 0, i_decoded = 0;
int i_decoded = 0;
while( (p_pic = p_dec->pf_decode_video( p_dec, pp_block ) ) ) while( (p_pic = p_dec->pf_decode_video( p_dec, pp_block ) ) )
{ {
......
...@@ -44,7 +44,9 @@ static inline void vout_statistic_Clean(vout_statistic_t *stat) ...@@ -44,7 +44,9 @@ static inline void vout_statistic_Clean(vout_statistic_t *stat)
(void) stat; (void) stat;
} }
static inline void vout_statistic_GetReset(vout_statistic_t *stat, int *displayed, int *lost) static inline void vout_statistic_GetReset(vout_statistic_t *stat,
unsigned *restrict displayed,
unsigned *restrict lost)
{ {
*displayed = atomic_exchange(&stat->displayed, 0); *displayed = atomic_exchange(&stat->displayed, 0);
*lost = atomic_exchange(&stat->lost, 0); *lost = atomic_exchange(&stat->lost, 0);
......
...@@ -320,7 +320,8 @@ void vout_ChangePause(vout_thread_t *vout, bool is_paused, mtime_t date) ...@@ -320,7 +320,8 @@ void vout_ChangePause(vout_thread_t *vout, bool is_paused, mtime_t date)
vout_control_WaitEmpty(&vout->p->control); vout_control_WaitEmpty(&vout->p->control);
} }
void vout_GetResetStatistic(vout_thread_t *vout, int *displayed, int *lost) void vout_GetResetStatistic(vout_thread_t *vout, unsigned *restrict displayed,
unsigned *restrict lost)
{ {
vout_statistic_GetReset( &vout->p->statistic, displayed, lost ); vout_statistic_GetReset( &vout->p->statistic, displayed, lost );
} }
......
...@@ -39,7 +39,8 @@ void spu_OffsetSubtitleDate( spu_t *p_spu, mtime_t i_duration ); ...@@ -39,7 +39,8 @@ void spu_OffsetSubtitleDate( spu_t *p_spu, mtime_t i_duration );
/** /**
* This function will return and reset internal statistics. * This function will return and reset internal statistics.
*/ */
void vout_GetResetStatistic( vout_thread_t *p_vout, int *pi_displayed, int *pi_lost ); void vout_GetResetStatistic( vout_thread_t *p_vout, unsigned *pi_displayed,
unsigned *pi_lost );
/** /**
* This function will ensure that all ready/displayed pciture have at most * This function will ensure that all ready/displayed pciture have at most
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment