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

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
« no previous file with comments | « webrtc/rtc_base/BUILD.gn ('k') | webrtc/rtc_base/bitrateallocationstrategy.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 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/checks.h"
19 #include "webrtc/rtc_base/refcount.h"
20 #include "webrtc/rtc_base/refcountedobject.h"
21
22 namespace rtc {
23
24 // Plugable strategy allows configuration of bitrate allocation per media track.
25 class BitrateAllocationStrategy : public RefCountedObject<RefCountInterface> {
nisse-webrtc 2017/09/06 09:04:02 Just spotted this, you should not inherit RefCount
alexnarest 2017/09/08 17:09:23 I think it is more convenient to app to create the
26 public:
27 struct TrackConfig {
28 TrackConfig(uint32_t min_bitrate_bps,
29 uint32_t max_bitrate_bps,
30 bool enforce_min_bitrate,
31 std::string track_id)
32 : min_bitrate_bps(min_bitrate_bps),
33 max_bitrate_bps(max_bitrate_bps),
34 enforce_min_bitrate(enforce_min_bitrate),
35 track_id(track_id) {}
36 TrackConfig(const TrackConfig& track_config) = default;
37 TrackConfig() {}
38
39 uint32_t min_bitrate_bps;
40 uint32_t max_bitrate_bps;
41 bool enforce_min_bitrate;
42 std::string track_id;
43 };
44
45 typedef std::vector<std::unique_ptr<TrackConfig>> TrackConfigs;
46
47 std::vector<uint32_t> SetAllBitratesToMinimum(
48 const TrackConfigs& track_configs);
49 std::vector<uint32_t> DistributeBitratesEvenly(
50 const TrackConfigs& track_configs,
51 uint32_t available_bitrate);
52
53 virtual std::vector<uint32_t> AllocateBitrates(
54 uint32_t available_bitrate,
55 const TrackConfigs& track_configs) = 0;
56 };
57
58 // Simple allocation strategy giving priority to audio at low bitrates.
59 class AudioPriorityBitrateAllocationStrategy
60 : public BitrateAllocationStrategy {
61 public:
62 AudioPriorityBitrateAllocationStrategy(std::string audio_track_id,
63 uint32_t sufficient_audio_bitrate);
64 std::vector<uint32_t> AllocateBitrates(
65 uint32_t available_bitrate,
66 const TrackConfigs& track_configs) override;
67
68 private:
69 std::string audio_track_id_;
70 uint32_t sufficient_audio_bitrate_;
71 };
72 } // namespace rtc
73
74 #endif // WEBRTC_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
OLDNEW
« no previous file with comments | « webrtc/rtc_base/BUILD.gn ('k') | webrtc/rtc_base/bitrateallocationstrategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698