Fix issue 218 with new solution
This one is slightly more elegant and efficient. BUG=http://code.google.com/p/webrtc/issues/detail?id=218 TEST= Review URL: http://webrtc-codereview.appspot.com/344009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1420 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
7859e10985
commit
33d5f69d5e
@ -475,22 +475,13 @@ ACMNetEQ::NetworkStatistics(
|
||||
int waiting_times[kArrayLen];
|
||||
int waiting_times_len = WebRtcNetEQ_GetRawFrameWaitingTimes(
|
||||
_inst[0], kArrayLen, waiting_times);
|
||||
if (waiting_times_len >= 0)
|
||||
if (waiting_times_len > 0)
|
||||
{
|
||||
std::vector<int> waiting_times_vec(waiting_times,
|
||||
waiting_times + waiting_times_len);
|
||||
sort(waiting_times_vec.begin(), waiting_times_vec.end());
|
||||
size_t size = waiting_times_vec.size();
|
||||
assert(size == static_cast<size_t>(waiting_times_len));
|
||||
if (size == 0)
|
||||
{
|
||||
statistics->meanWaitingTimeMs = -1;
|
||||
statistics->medianWaitingTimeMs = -1;
|
||||
statistics->minWaitingTimeMs = -1;
|
||||
statistics->maxWaitingTimeMs = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size % 2 == 0)
|
||||
{
|
||||
statistics->medianWaitingTimeMs =
|
||||
@ -509,6 +500,12 @@ ACMNetEQ::NetworkStatistics(
|
||||
}
|
||||
statistics->meanWaitingTimeMs = static_cast<int>(sum / size);
|
||||
}
|
||||
else if (waiting_times_len == 0)
|
||||
{
|
||||
statistics->meanWaitingTimeMs = -1;
|
||||
statistics->medianWaitingTimeMs = -1;
|
||||
statistics->minWaitingTimeMs = -1;
|
||||
statistics->maxWaitingTimeMs = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user