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

Side by Side Diff: webrtc/call/bitrate_allocator.h

Issue 2954903002: Media track ID visibility at BWE level
Patch Set: Media track ID visibility at BWE level Created 3 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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_CALL_BITRATE_ALLOCATOR_H_ 11 #ifndef WEBRTC_CALL_BITRATE_ALLOCATOR_H_
12 #define WEBRTC_CALL_BITRATE_ALLOCATOR_H_ 12 #define WEBRTC_CALL_BITRATE_ALLOCATOR_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include <map> 16 #include <map>
17 #include <utility> 17 #include <utility>
18 #include <vector> 18 #include <vector>
19 #include <string>
19 20
20 #include "webrtc/base/sequenced_task_checker.h" 21 #include "webrtc/base/sequenced_task_checker.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 class Clock; 25 class Clock;
25 26
26 // Used by all send streams with adaptive bitrate, to get the currently 27 // Used by all send streams with adaptive bitrate, to get the currently
27 // allocated bitrate for the send stream. The current network properties are 28 // allocated bitrate for the send stream. The current network properties are
28 // given at the same time, to let the send stream decide about possible loss 29 // given at the same time, to let the send stream decide about possible loss
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // this observer, even if the BWE is too low, 'false' will allocate 0 to 76 // this observer, even if the BWE is too low, 'false' will allocate 0 to
76 // the observer if BWE doesn't allow |min_bitrate_bps|. 77 // the observer if BWE doesn't allow |min_bitrate_bps|.
77 // Note that |observer|->OnBitrateUpdated() will be called within the scope of 78 // Note that |observer|->OnBitrateUpdated() will be called within the scope of
78 // this method with the current rtt, fraction_loss and available bitrate and 79 // this method with the current rtt, fraction_loss and available bitrate and
79 // that the bitrate in OnBitrateUpdated will be zero if the |observer| is 80 // that the bitrate in OnBitrateUpdated will be zero if the |observer| is
80 // currently not allowed to send data. 81 // currently not allowed to send data.
81 void AddObserver(BitrateAllocatorObserver* observer, 82 void AddObserver(BitrateAllocatorObserver* observer,
82 uint32_t min_bitrate_bps, 83 uint32_t min_bitrate_bps,
83 uint32_t max_bitrate_bps, 84 uint32_t max_bitrate_bps,
84 uint32_t pad_up_bitrate_bps, 85 uint32_t pad_up_bitrate_bps,
85 bool enforce_min_bitrate); 86 bool enforce_min_bitrate,
87 std::string track_id);
86 88
87 // Removes a previously added observer, but will not trigger a new bitrate 89 // Removes a previously added observer, but will not trigger a new bitrate
88 // allocation. 90 // allocation.
89 void RemoveObserver(BitrateAllocatorObserver* observer); 91 void RemoveObserver(BitrateAllocatorObserver* observer);
90 92
91 // Returns initial bitrate allocated for |observer|. If |observer| is not in 93 // Returns initial bitrate allocated for |observer|. If |observer| is not in
92 // the list of added observers, a best guess is returned. 94 // the list of added observers, a best guess is returned.
93 int GetStartBitrate(BitrateAllocatorObserver* observer); 95 int GetStartBitrate(BitrateAllocatorObserver* observer);
94 96
95 private: 97 private:
96 // Note: All bitrates for member variables and methods are in bps. 98 // Note: All bitrates for member variables and methods are in bps.
97 struct ObserverConfig { 99 struct ObserverConfig {
98 ObserverConfig(BitrateAllocatorObserver* observer, 100 ObserverConfig(BitrateAllocatorObserver* observer,
99 uint32_t min_bitrate_bps, 101 uint32_t min_bitrate_bps,
100 uint32_t max_bitrate_bps, 102 uint32_t max_bitrate_bps,
101 uint32_t pad_up_bitrate_bps, 103 uint32_t pad_up_bitrate_bps,
102 bool enforce_min_bitrate) 104 bool enforce_min_bitrate,
105 std::string track_id)
103 : observer(observer), 106 : observer(observer),
104 min_bitrate_bps(min_bitrate_bps), 107 min_bitrate_bps(min_bitrate_bps),
105 max_bitrate_bps(max_bitrate_bps), 108 max_bitrate_bps(max_bitrate_bps),
106 pad_up_bitrate_bps(pad_up_bitrate_bps), 109 pad_up_bitrate_bps(pad_up_bitrate_bps),
107 enforce_min_bitrate(enforce_min_bitrate), 110 enforce_min_bitrate(enforce_min_bitrate),
108 allocated_bitrate_bps(-1), 111 allocated_bitrate_bps(-1),
109 media_ratio(1.0) {} 112 media_ratio(1.0),
113 track_id(track_id) {}
110 114
111 BitrateAllocatorObserver* observer; 115 BitrateAllocatorObserver* observer;
112 uint32_t min_bitrate_bps; 116 uint32_t min_bitrate_bps;
113 uint32_t max_bitrate_bps; 117 uint32_t max_bitrate_bps;
114 uint32_t pad_up_bitrate_bps; 118 uint32_t pad_up_bitrate_bps;
115 bool enforce_min_bitrate; 119 bool enforce_min_bitrate;
116 int64_t allocated_bitrate_bps; 120 int64_t allocated_bitrate_bps;
117 double media_ratio; // Part of the total bitrate used for media [0.0, 1.0]. 121 double media_ratio; // Part of the total bitrate used for media [0.0, 1.0].
122 std::string track_id;
nisse-webrtc 2017/09/18 08:44:28 Can it be const? (I guess all other members are ex
alexnarest 2017/09/29 12:13:57 Other members such as observer, min/max bitrate, e
118 }; 123 };
119 124
120 // Calculates the minimum requested send bitrate and max padding bitrate and 125 // Calculates the minimum requested send bitrate and max padding bitrate and
121 // calls LimitObserver::OnAllocationLimitsChanged. 126 // calls LimitObserver::OnAllocationLimitsChanged.
122 void UpdateAllocationLimits(); 127 void UpdateAllocationLimits();
123 128
124 typedef std::vector<ObserverConfig> ObserverConfigs; 129 typedef std::vector<ObserverConfig> ObserverConfigs;
125 ObserverConfigs::iterator FindObserverConfig( 130 ObserverConfigs::iterator FindObserverConfig(
126 const BitrateAllocatorObserver* observer); 131 const BitrateAllocatorObserver* observer);
127 132
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int64_t last_bwe_period_ms_ GUARDED_BY(&sequenced_checker_); 168 int64_t last_bwe_period_ms_ GUARDED_BY(&sequenced_checker_);
164 // Number of mute events based on too low BWE, not network up/down. 169 // Number of mute events based on too low BWE, not network up/down.
165 int num_pause_events_ GUARDED_BY(&sequenced_checker_); 170 int num_pause_events_ GUARDED_BY(&sequenced_checker_);
166 Clock* const clock_ GUARDED_BY(&sequenced_checker_); 171 Clock* const clock_ GUARDED_BY(&sequenced_checker_);
167 int64_t last_bwe_log_time_ GUARDED_BY(&sequenced_checker_); 172 int64_t last_bwe_log_time_ GUARDED_BY(&sequenced_checker_);
168 uint32_t total_requested_padding_bitrate_ GUARDED_BY(&sequenced_checker_); 173 uint32_t total_requested_padding_bitrate_ GUARDED_BY(&sequenced_checker_);
169 uint32_t total_requested_min_bitrate_ GUARDED_BY(&sequenced_checker_); 174 uint32_t total_requested_min_bitrate_ GUARDED_BY(&sequenced_checker_);
170 }; 175 };
171 } // namespace webrtc 176 } // namespace webrtc
172 #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_ 177 #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698