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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/rtc_base/BUILD.gn ('k') | webrtc/rtc_base/bitrateallocationstrategy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/rtc_base/bitrateallocationstrategy.h
diff --git a/webrtc/rtc_base/bitrateallocationstrategy.h b/webrtc/rtc_base/bitrateallocationstrategy.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa5f7b5ae3f7901091f3eef96439af37acd2a8a3
--- /dev/null
+++ b/webrtc/rtc_base/bitrateallocationstrategy.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
+#define WEBRTC_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+#include "webrtc/rtc_base/checks.h"
+#include "webrtc/rtc_base/refcount.h"
+#include "webrtc/rtc_base/refcountedobject.h"
+
+namespace rtc {
+
+// Plugable strategy allows configuration of bitrate allocation per media track.
+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
+ public:
+ struct TrackConfig {
+ TrackConfig(uint32_t min_bitrate_bps,
+ uint32_t max_bitrate_bps,
+ bool enforce_min_bitrate,
+ std::string track_id)
+ : min_bitrate_bps(min_bitrate_bps),
+ max_bitrate_bps(max_bitrate_bps),
+ enforce_min_bitrate(enforce_min_bitrate),
+ track_id(track_id) {}
+ TrackConfig(const TrackConfig& track_config) = default;
+ TrackConfig() {}
+
+ uint32_t min_bitrate_bps;
+ uint32_t max_bitrate_bps;
+ bool enforce_min_bitrate;
+ std::string track_id;
+ };
+
+ typedef std::vector<std::unique_ptr<TrackConfig>> TrackConfigs;
+
+ std::vector<uint32_t> SetAllBitratesToMinimum(
+ const TrackConfigs& track_configs);
+ std::vector<uint32_t> DistributeBitratesEvenly(
+ const TrackConfigs& track_configs,
+ uint32_t available_bitrate);
+
+ virtual std::vector<uint32_t> AllocateBitrates(
+ uint32_t available_bitrate,
+ const TrackConfigs& track_configs) = 0;
+};
+
+// Simple allocation strategy giving priority to audio at low bitrates.
+class AudioPriorityBitrateAllocationStrategy
+ : public BitrateAllocationStrategy {
+ public:
+ AudioPriorityBitrateAllocationStrategy(std::string audio_track_id,
+ uint32_t sufficient_audio_bitrate);
+ std::vector<uint32_t> AllocateBitrates(
+ uint32_t available_bitrate,
+ const TrackConfigs& track_configs) override;
+
+ private:
+ std::string audio_track_id_;
+ uint32_t sufficient_audio_bitrate_;
+};
+} // namespace rtc
+
+#endif // WEBRTC_RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
« 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