Commit 64c6d660 authored by Frédéric Yhuel's avatar Frédéric Yhuel Committed by Jean-Baptiste Kempf

stream_filter: smooth: minor optimization

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4b94eddd
......@@ -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;
......
......@@ -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;
}
}
......
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