Change probe counting from sec to state inc
parent
b73b8c1aa0
commit
9a1646a39d
|
|
@ -59,7 +59,8 @@ class NetworkIndicator extends React.Component
|
||||||
currBitrate : 0,
|
currBitrate : 0,
|
||||||
maxBitrate : 0,
|
maxBitrate : 0,
|
||||||
avgBitrate : 0,
|
avgBitrate : 0,
|
||||||
medBitrate : 0
|
medBitrate : 1,
|
||||||
|
probeCount : 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,12 +126,12 @@ class NetworkIndicator extends React.Component
|
||||||
// probe
|
// probe
|
||||||
const probe = [ ...this.state.probe ]; // clone
|
const probe = [ ...this.state.probe ]; // clone
|
||||||
|
|
||||||
const sec = new Date().getSeconds()
|
if (this.state.probeCount < 5)
|
||||||
.toString()
|
this.setState({ probeCount: this.state.probeCount + 1});
|
||||||
.split('')
|
else
|
||||||
.map(Number)[1];
|
this.setState({ probeCount: 1 });
|
||||||
|
|
||||||
probe[sec] = currBitrate; // add/update next element
|
probe[this.state.probeCount] = currBitrate; // add/update next element
|
||||||
|
|
||||||
// median
|
// median
|
||||||
const med = (arr) =>
|
const med = (arr) =>
|
||||||
|
|
@ -171,6 +172,7 @@ class NetworkIndicator extends React.Component
|
||||||
logger.warn('[maxBitrate: "%s"]', maxBitrate);
|
logger.warn('[maxBitrate: "%s"]', maxBitrate);
|
||||||
logger.warn('[medBitrate: "%s"]', medBitrate);
|
logger.warn('[medBitrate: "%s"]', medBitrate);
|
||||||
logger.warn('[avgBitrate: "%s"]', avgBitrate);
|
logger.warn('[avgBitrate: "%s"]', avgBitrate);
|
||||||
|
logger.warn('[probeCount: "%s"]', this.state.probeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount()
|
componentDidMount()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue