Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: webrtc/base/rate_limiter.h

Issue 2061423003: Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moved rate limiter back to congestion controller Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 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_BASE_RATE_LIMITER_H_
12 #define WEBRTC_BASE_RATE_LIMITER_H_
13
14 #include <limits>
15
16 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/rate_statistics.h"
19
20 namespace webrtc {
21
22 class Clock;
23
24 class RateLimiter {
tommi 2016/07/07 12:48:46 documentation?
sprang_webrtc 2016/07/07 13:46:51 Done.
25 public:
26 RateLimiter(Clock* clock, int64_t max_retransmission_window_ms);
27 virtual ~RateLimiter();
tommi 2016/07/07 12:48:46 why virtual?
sprang_webrtc 2016/07/07 13:46:51 I had the methods be virtual before, in order to b
tommi 2016/07/08 08:52:20 great. I think that's an improvement and the fact
28
29 // Try to use rate to send bytes. Returns true on success and if so updates
30 // current rate.
31 bool TryUseRate(size_t packet_size_bytes);
32
33 // Set the maximum bitrate, in bps, that this limiter allows to send.
34 void SetMaxRate(uint32_t max_rate_bps);
35
36 // Set the window size over which to measure the current bitrate.
37 // For retransmissions, this is typically the RTT.
38 void SetWindowSize(int64_t window_size_ms);
39
40 private:
41 Clock* const clock_;
42 rtc::CriticalSection lock_;
43 RateStatistics current_rate_ GUARDED_BY(lock_);
44 int64_t window_size_ms_ GUARDED_BY(lock_);
45 uint32_t max_rate_bps_ GUARDED_BY(lock_);
46
47 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RateLimiter);
48 };
49
50 } // namespace webrtc
51
52 #endif // WEBRTC_BASE_RATE_LIMITER_H_
OLDNEW
« no previous file with comments | « webrtc/base/base.gyp ('k') | webrtc/base/rate_limiter.cc » ('j') | webrtc/base/rate_limiter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698