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

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

Issue 2243823002: Added ProbeBitrate(bitrate_bps, num_probes) to BitrateProber. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Clean up api Created 4 years, 4 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
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 <deque>
15 #include <list>
16 #include <queue>
17 15
18 #include "webrtc/typedefs.h" 16 #include "webrtc/typedefs.h"
19 17
20 namespace webrtc { 18 namespace webrtc {
21 19
22 // Note that this class isn't thread-safe by itself and therefore relies 20 // Note that this class isn't thread-safe by itself and therefore relies
23 // on being protected by the caller. 21 // on being protected by the caller.
24 class BitrateProber { 22 class BitrateProber {
25 public: 23 public:
26 BitrateProber(); 24 BitrateProber();
27 25
28 void SetEnabled(bool enable); 26 void SetEnabled(bool enable);
danilchap 2016/08/12 15:13:34 Is this function still in use? Seems dangerous to
29 27
30 // Returns true if the prober is in a probing session, i.e., it currently 28 // Returns true if the prober is in a probing session, i.e., it currently
31 // wants packets to be sent out according to the time returned by 29 // wants packets to be sent out according to the time returned by
32 // TimeUntilNextProbe(). 30 // TimeUntilNextProbe().
33 bool IsProbing() const; 31 bool IsProbing() const;
34 32
35 // Initializes a new probing session if the prober is allowed to probe. Does 33 // Initializes a new probing session if the prober is allowed to probe. Does
36 // not initialize the prober unless the packet size is large enough to probe 34 // not initialize the prober unless the packet size is large enough to probe
37 // with. 35 // with.
38 void OnIncomingPacket(uint32_t bitrate_bps, 36 void OnIncomingPacket(size_t packet_size);
39 size_t packet_size, 37
40 int64_t now_ms); 38 // Create a cluster used to probe for |bitrate_bps| with |num_packets| number
39 // of packets.
40 void ProbeBitrate(uint32_t bitrate_bps, int num_packets);
stefan-webrtc 2016/08/12 13:19:59 ProbeAtBitrate or CreateProbeAtBitrate?
philipel 2016/08/12 14:08:07 Change to ProbeAtBitrate.
41 41
42 // 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
43 // get accurate probing. 43 // get accurate probing.
44 int TimeUntilNextProbe(int64_t now_ms); 44 int TimeUntilNextProbe(int64_t now_ms);
45 45
46 // Which cluster that is currently being used for probing. 46 // Which cluster that is currently being used for probing.
47 int CurrentClusterId() const; 47 int CurrentClusterId() const;
48 48
49 // 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
50 // packet. 50 // packet.
(...skipping 24 matching lines...) Expand all
75 int id = -1; 75 int id = -1;
76 }; 76 };
77 77
78 // Resets the state of the prober and clears any cluster/timing data tracked. 78 // Resets the state of the prober and clears any cluster/timing data tracked.
79 void ResetState(); 79 void ResetState();
80 80
81 ProbingState probing_state_; 81 ProbingState probing_state_;
82 // Probe bitrate per packet. These are used to compute the delta relative to 82 // Probe bitrate per packet. These are used to compute the delta relative to
83 // the previous probe packet based on the size and time when that packet was 83 // the previous probe packet based on the size and time when that packet was
84 // sent. 84 // sent.
85 std::queue<ProbeCluster> clusters_; 85 std::deque<ProbeCluster> clusters_;
86 size_t packet_size_last_sent_; 86 size_t packet_size_last_sent_;
87 // The last time a probe was sent. 87 // The last time a probe was sent.
88 int64_t time_last_probe_sent_ms_; 88 int64_t time_last_probe_sent_ms_;
89 int next_cluster_id_; 89 int next_cluster_id_;
90 }; 90 };
91 } // namespace webrtc 91 } // namespace webrtc
92 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_ 92 #endif // WEBRTC_MODULES_PACING_BITRATE_PROBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698