Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/video_coding/main/source/rtt_filter.h @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 2.3 KB
Line 
1/*
2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_VIDEO_CODING_RTT_FILTER_H_
12#define WEBRTC_MODULES_VIDEO_CODING_RTT_FILTER_H_
13
14#include "webrtc/typedefs.h"
15
16namespace webrtc
17{
18
19class VCMRttFilter
20{
21public:
22    VCMRttFilter(int32_t vcmId = 0, int32_t receiverId = 0);
23
24    VCMRttFilter& operator=(const VCMRttFilter& rhs);
25
26    // Resets the filter.
27    void Reset();
28    // Updates the filter with a new sample.
29    void Update(uint32_t rttMs);
30    // A getter function for the current RTT level in ms.
31    uint32_t RttMs() const;
32
33private:
34    // The size of the drift and jump memory buffers
35    // and thus also the detection threshold for these
36    // detectors in number of samples.
37    enum { kMaxDriftJumpCount = 5 };
38    // Detects RTT jumps by comparing the difference between
39    // samples and average to the standard deviation.
40    // Returns true if the long time statistics should be updated
41    // and false otherwise
42    bool JumpDetection(uint32_t rttMs);
43    // Detects RTT drifts by comparing the difference between
44    // max and average to the standard deviation.
45    // Returns true if the long time statistics should be updated
46    // and false otherwise
47    bool DriftDetection(uint32_t rttMs);
48    // Computes the short time average and maximum of the vector buf.
49    void ShortRttFilter(uint32_t* buf, uint32_t length);
50
51    int32_t         _vcmId;
52    int32_t         _receiverId;
53    bool                  _gotNonZeroUpdate;
54    double                _avgRtt;
55    double                _varRtt;
56    uint32_t        _maxRtt;
57    uint32_t        _filtFactCount;
58    const uint32_t  _filtFactMax;
59    const double          _jumpStdDevs;
60    const double          _driftStdDevs;
61    int32_t         _jumpCount;
62    int32_t         _driftCount;
63    const int32_t   _detectThreshold;
64    uint32_t        _jumpBuf[kMaxDriftJumpCount];
65    uint32_t        _driftBuf[kMaxDriftJumpCount];
66};
67
68}  // namespace webrtc
69
70#endif // WEBRTC_MODULES_VIDEO_CODING_RTT_FILTER_H_
Note: See TracBrowser for help on using the repository browser.