[vlc-commits] vout: use unsigned stats
Rémi Denis-Courmont
git at videolan.org
Tue Jan 26 19:29:01 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jan 26 20:03:17 2016 +0200| [153d58d232023d0dee0fb4cbdaa37771a35d3622] | committer: Rémi Denis-Courmont
vout: use unsigned stats
Inaccurate statistics are a lesser evil than undefined overflows.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=153d58d232023d0dee0fb4cbdaa37771a35d3622
---
src/input/decoder.c | 15 +++++++--------
src/video_output/statistic.h | 4 +++-
src/video_output/video_output.c | 3 ++-
src/video_output/vout_control.h | 3 ++-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index b54d37c..d632064 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -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,
- int *pi_lost_sum )
+ unsigned *restrict pi_lost_sum )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
vout_thread_t *p_vout = p_owner->p_vout;
@@ -926,12 +926,12 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
return 0;
}
-static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded,
- int lost )
+static void DecoderUpdateStatVideo( decoder_t *p_dec, unsigned decoded,
+ unsigned lost )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
input_thread_t *p_input = p_owner->p_input;
- int displayed = 0;
+ unsigned displayed = 0;
/* Update ugly stat */
if( p_input == NULL )
@@ -939,7 +939,7 @@ static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded,
if( p_owner->p_vout != NULL )
{
- int vout_lost = 0;
+ unsigned vout_lost = 0;
vout_GetResetStatistic( p_owner->p_vout, &displayed, &vout_lost );
lost += vout_lost;
@@ -955,7 +955,7 @@ static void DecoderUpdateStatVideo( decoder_t *p_dec, int decoded,
static int DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
{
assert( p_pic );
- int i_lost = 0;
+ unsigned i_lost = 0;
int ret = DecoderPlayVideo( p_dec, p_pic, &i_lost );
@@ -967,8 +967,7 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
{
picture_t *p_pic;
block_t **pp_block = p_block ? &p_block : NULL;
- int i_lost = 0;
- int i_decoded = 0;
+ unsigned i_lost = 0, i_decoded = 0;
while( (p_pic = p_dec->pf_decode_video( p_dec, pp_block ) ) )
{
diff --git a/src/video_output/statistic.h b/src/video_output/statistic.h
index 083b0d7..12f880d 100644
--- a/src/video_output/statistic.h
+++ b/src/video_output/statistic.h
@@ -44,7 +44,9 @@ static inline void vout_statistic_Clean(vout_statistic_t *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);
*lost = atomic_exchange(&stat->lost, 0);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 9b2f0e4..cbc8dc0 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -320,7 +320,8 @@ void vout_ChangePause(vout_thread_t *vout, bool is_paused, mtime_t date)
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 );
}
diff --git a/src/video_output/vout_control.h b/src/video_output/vout_control.h
index a9ba29c..0be3313 100644
--- a/src/video_output/vout_control.h
+++ b/src/video_output/vout_control.h
@@ -39,7 +39,8 @@ void spu_OffsetSubtitleDate( spu_t *p_spu, mtime_t i_duration );
/**
* 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
More information about the vlc-commits
mailing list