[vlc-devel] [PATCH 2/2] stream_filter: smooth: minor optimization
Frédéric Yhuel
yhuelf at gmail.com
Sun Nov 30 21:17:41 CET 2014
---
modules/stream_filter/smooth/smooth.h | 1 +
modules/stream_filter/smooth/utils.c | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/stream_filter/smooth/smooth.h b/modules/stream_filter/smooth/smooth.h
index 06f7236..1abeb7a 100644
--- a/modules/stream_filter/smooth/smooth.h
+++ b/modules/stream_filter/smooth/smooth.h
@@ -93,6 +93,7 @@ typedef struct sms_stream_s
int type;
quality_level_t *current_qlvl; /* current quality level for Download() */
uint64_t rgi_bw[SMS_BW_SHORTSTATS]; /* Measured bandwidths of the N last chunks */
+ int rgi_tidx; /* tail index of rgi_bw */
uint64_t i_obw; /* Overwall bandwidth average */
unsigned int i_obw_samples; /* used to compute overall incrementally */
} sms_stream_t;
diff --git a/modules/stream_filter/smooth/utils.c b/modules/stream_filter/smooth/utils.c
index 5ac45da..18ad13d 100644
--- a/modules/stream_filter/smooth/utils.c
+++ b/modules/stream_filter/smooth/utils.c
@@ -170,9 +170,8 @@ void bw_stats_put( sms_stream_t *sms, const uint64_t bw )
}
else
{
- memmove( sms->rgi_bw, &sms->rgi_bw[1],
- sizeof(sms->rgi_bw[0]) * (SMS_BW_SHORTSTATS - 1) );
- sms->rgi_bw[SMS_BW_SHORTSTATS - 1] = bw;
+ sms->rgi_tidx = (sms->rgi_tidx + 1) % SMS_BW_SHORTSTATS;
+ sms->rgi_bw[sms->rgi_tidx] = bw;
}
}
--
2.1.3
More information about the vlc-devel
mailing list