vlc | branch: master | Frédéric Yhuel <[email protected]> | Sun Nov 30 21:17:41 2014 +0100| [64c6d66017a81ef97fd45fb4cdcae071545aa766] | committer: Jean-Baptiste Kempf
stream_filter: smooth: minor optimization Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64c6d66017a81ef97fd45fb4cdcae071545aa766 --- 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; } } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
