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

Side by Side Diff: webrtc/modules/pacing/bitrate_prober.h

Issue 1946173002: Bitrate prober now keep track of probing cluster id. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 7 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 | « no previous file | webrtc/modules/pacing/bitrate_prober.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 11 #ifndef WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
12 #define WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 12 #define WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
13 13
14 #include <cstddef> 14 #include <cstddef>
15 #include <list> 15 #include <list>
16 #include <queue>
16 17
17 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 21
21 // Note that this class isn't thread-safe by itself and therefore relies 22 // Note that this class isn't thread-safe by itself and therefore relies
22 // on being protected by the caller. 23 // on being protected by the caller.
23 class BitrateProber { 24 class BitrateProber {
24 public: 25 public:
25 BitrateProber(); 26 BitrateProber();
26 27
27 void SetEnabled(bool enable); 28 void SetEnabled(bool enable);
28 29
29 // Returns true if the prober is in a probing session, i.e., it currently 30 // Returns true if the prober is in a probing session, i.e., it currently
30 // wants packets to be sent out according to the time returned by 31 // wants packets to be sent out according to the time returned by
31 // TimeUntilNextProbe(). 32 // TimeUntilNextProbe().
32 bool IsProbing() const; 33 bool IsProbing() const;
33 34
34 // Initializes a new probing session if the prober is allowed to probe. Does 35 // Initializes a new probing session if the prober is allowed to probe. Does
35 // not initialize the prober unless the packet size is large enough to probe 36 // not initialize the prober unless the packet size is large enough to probe
36 // with. 37 // with.
37 void OnIncomingPacket(uint32_t bitrate_bps, 38 void OnIncomingPacket(uint32_t bitrate_bps,
38 size_t packet_size, 39 size_t packet_size,
39 int64_t now_ms); 40 int64_t now_ms);
40 41
41 // Returns the number of milliseconds until the next packet should be sent to 42 // Returns the number of milliseconds until the next packet should be sent to
42 // get accurate probing. 43 // get accurate probing.
43 int TimeUntilNextProbe(int64_t now_ms); 44 int TimeUntilNextProbe(int64_t now_ms);
44 45
46 // Which cluster that is currently being used for probing.
47 int CurrentClusterId() const;
48
45 // Returns the number of bytes that the prober recommends for the next probe 49 // Returns the number of bytes that the prober recommends for the next probe
46 // packet. 50 // packet.
47 size_t RecommendedPacketSize() const; 51 size_t RecommendedPacketSize() const;
48 52
49 // Called to report to the prober that a packet has been sent, which helps the 53 // Called to report to the prober that a packet has been sent, which helps the
50 // prober know when to move to the next packet in a probe. 54 // prober know when to move to the next packet in a probe.
51 void PacketSent(int64_t now_ms, size_t packet_size); 55 void PacketSent(int64_t now_ms, size_t packet_size);
52 56
53 private: 57 private:
54 enum ProbingState { kDisabled, kAllowedToProbe, kProbing, kWait }; 58 enum ProbingState { kDisabled, kAllowedToProbe, kProbing, kWait };
55 59
60 struct ProbeCluster {
61 int max_probe_packets = 0;
62 int sent_probe_packets = 0;
63 int probe_bitrate_bps = 0;
64 int id = -1;
65 };
66
56 ProbingState probing_state_; 67 ProbingState probing_state_;
57 // Probe bitrate per packet. These are used to compute the delta relative to 68 // Probe bitrate per packet. These are used to compute the delta relative to
58 // the previous probe packet based on the size and time when that packet was 69 // the previous probe packet based on the size and time when that packet was
59 // sent. 70 // sent.
60 std::list<uint32_t> probe_bitrates_; 71 std::queue<ProbeCluster> clusters_;
61 size_t packet_size_last_send_; 72 size_t packet_size_last_send_;
62 int64_t time_last_send_ms_; 73 int64_t time_last_send_ms_;
74 int cluster_id_;
63 }; 75 };
64 } // namespace webrtc 76 } // namespace webrtc
65 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 77 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/pacing/bitrate_prober.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698