blob: 90ef6bb5e54b254d62f524a5809ddae581f2c5f7 [file] [log] [blame]
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
#include <queue>
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/video_coding/percentile_filter.h"
#include "webrtc/typedefs.h"
namespace webrtc {
class VCMCodecTimer {
// Add a new decode time to the filter.
void AddTiming(int64_t new_decode_time_ms, int64_t now_ms);
// Get the required decode time in ms. It is the 95th percentile observed
// decode time within a time window.
int64_t RequiredDecodeTimeMs() const;
struct Sample {
Sample(int64_t decode_time_ms, int64_t sample_time_ms);
int64_t decode_time_ms;
int64_t sample_time_ms;
// The number of samples ignored so far.
int ignored_sample_count_;
// Queue with history of latest decode time values.
std::queue<Sample> history_;
// |filter_| contains the same values as |history_|, but in a data structure
// that allows efficient retrieval of the percentile value.
PercentileFilter filter_;
} // namespace webrtc