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

Side by Side Diff: webrtc/rtc_base/bitrateallocationstrategy.h

Issue 2996643002: BWE allocation strategy
Patch Set: BWE allocation strategy Created 3 years, 3 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 /*
Taylor Brandstetter 2017/09/11 16:55:07 Not sure if this has been discussed before, but do
alexnarest 2017/09/14 13:08:34 I thought rtc_base/ is relevant because this provi
Taylor Brandstetter 2017/09/15 01:26:21 Something I forgot from the round of comments I ju
nisse-webrtc 2017/09/15 07:05:44 Agreed. When moving to api/, be extra careful abou
2 * Copyright 2017 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_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
12 #define WEBRTC_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
13
14 #include <map>
15 #include <memory>
16 #include <string>
17 #include <vector>
18 #include "webrtc/rtc_base/array_view.h"
19 #include "webrtc/rtc_base/checks.h"
20 #include "webrtc/rtc_base/refcount.h"
21 #include "webrtc/rtc_base/refcountedobject.h"
22
23 namespace rtc {
24
25 // Plugable strategy allows configuration of bitrate allocation per media track.
Taylor Brandstetter 2017/09/11 16:55:07 Would be nice to have a more detailed explanation
alexnarest 2017/09/14 13:08:33 Done.
26 class BitrateAllocationStrategy {
27 public:
Taylor Brandstetter 2017/09/11 16:55:07 Can you document the arguments to TrackConfig's co
alexnarest 2017/09/14 13:08:34 Done.
28 struct TrackConfig {
29 TrackConfig(uint32_t min_bitrate_bps,
30 uint32_t max_bitrate_bps,
31 bool enforce_min_bitrate,
32 std::string track_id)
33 : min_bitrate_bps(min_bitrate_bps),
34 max_bitrate_bps(max_bitrate_bps),
35 enforce_min_bitrate(enforce_min_bitrate),
36 track_id(track_id) {}
37 TrackConfig(const TrackConfig& track_config) = default;
38 virtual ~TrackConfig() = default;
39 TrackConfig() {}
40
41 uint32_t min_bitrate_bps;
42 uint32_t max_bitrate_bps;
43 bool enforce_min_bitrate;
44 std::string track_id;
45 };
46
47 std::vector<uint32_t> SetAllBitratesToMinimum(
48 const ArrayView<const TrackConfig*> track_configs);
49 std::vector<uint32_t> DistributeBitratesEvenly(
50 const ArrayView<const TrackConfig*> track_configs,
51 uint32_t available_bitrate);
Taylor Brandstetter 2017/09/11 16:55:07 If these methods aren't virtual, do they need to b
alexnarest 2017/09/14 13:08:34 These are utility methods. Future strategies will
Taylor Brandstetter 2017/09/15 01:24:41 I understand. I just think it would be cleaner if
nisse-webrtc 2017/09/15 07:05:44 Are they intended as internal utility functions, o
52
53 virtual std::vector<uint32_t> AllocateBitrates(
Taylor Brandstetter 2017/09/11 16:55:06 Some comments around this would be helpful. Some q
alexnarest 2017/09/14 13:08:33 Done.
54 uint32_t available_bitrate,
55 const ArrayView<const TrackConfig*> track_configs) = 0;
56
57 virtual ~BitrateAllocationStrategy() = default;
58 };
59
60 // Simple allocation strategy giving priority to audio at low bitrates.
Taylor Brandstetter 2017/09/11 16:55:06 Can this comment elaborate a bit more? I'd summari
alexnarest 2017/09/14 13:08:34 Done.
61 class AudioPriorityBitrateAllocationStrategy
62 : public BitrateAllocationStrategy {
63 public:
64 AudioPriorityBitrateAllocationStrategy(std::string audio_track_id,
65 uint32_t sufficient_audio_bitrate);
66 std::vector<uint32_t> AllocateBitrates(
67 uint32_t available_bitrate,
68 const ArrayView<const TrackConfig*> track_configs) override;
69
70 private:
71 std::string audio_track_id_;
72 uint32_t sufficient_audio_bitrate_;
73 };
74 } // namespace rtc
75
76 #endif // WEBRTC_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698