Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
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;
}
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;
}
}