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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/bitrate.h

Issue 2061423003: Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed nit 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/rtp_rtcp.gypi ('k') | webrtc/modules/rtp_rtcp/source/bitrate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 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_RTP_RTCP_SOURCE_BITRATE_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_
13
14 #include <stdio.h>
15
16 #include <list>
17
18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/common_types.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
21 #include "webrtc/typedefs.h"
22
23 namespace webrtc {
24
25 class Clock;
26
27 class Bitrate {
28 public:
29 class Observer;
30 Bitrate(Clock* clock, Observer* observer);
31 virtual ~Bitrate();
32
33 // Calculates rates.
34 void Process();
35
36 // Update with a packet.
37 void Update(const size_t bytes);
38
39 // Packet rate last second, updated roughly every 100 ms.
40 uint32_t PacketRate() const;
41
42 // Bitrate last second, updated roughly every 100 ms.
43 uint32_t BitrateLast() const;
44
45 // Bitrate last second, updated now.
46 uint32_t BitrateNow() const;
47
48 int64_t time_last_rate_update() const;
49
50 class Observer {
51 public:
52 Observer() {}
53 virtual ~Observer() {}
54
55 virtual void BitrateUpdated(const BitrateStatistics& stats) = 0;
56 };
57
58 protected:
59 Clock* clock_;
60
61 private:
62 rtc::CriticalSection crit_;
63 uint32_t packet_rate_;
64 uint32_t bitrate_;
65 uint8_t bitrate_next_idx_;
66 int64_t packet_rate_array_[10];
67 int64_t bitrate_array_[10];
68 int64_t bitrate_diff_ms_[10];
69 int64_t time_last_rate_update_;
70 size_t bytes_count_;
71 uint32_t packet_count_;
72 Observer* const observer_;
73 };
74
75 } // namespace webrtc
76
77 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/rtp_rtcp.gypi ('k') | webrtc/modules/rtp_rtcp/source/bitrate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698