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

Unified Diff: webrtc/common_types.h

Issue 2434073003: Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Fixed sign mismatch Created 4 years, 2 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
Index: webrtc/common_types.h
diff --git a/webrtc/common_types.h b/webrtc/common_types.h
index b1842ef59598e78e86f99f71d495661b0d1a9483..1217c2427b4de9e4d38f1a4a0c0d304f4401828a 100644
--- a/webrtc/common_types.h
+++ b/webrtc/common_types.h
@@ -524,7 +524,7 @@ struct VideoCodecVP8 {
bool automaticResizeOn;
bool frameDroppingOn;
int keyFrameInterval;
- const TemporalLayersFactory* tl_factory;
+ TemporalLayersFactory* tl_factory;
};
// VP9 specific.
@@ -622,6 +622,35 @@ struct VideoCodec {
bool operator!=(const VideoCodec& other) const = delete;
};
+class BitrateAllocation {
+ public:
+ static constexpr size_t kMaxBitrateBps = 100000000;
perkj_webrtc 2016/10/27 12:57:31 nit : add comment 100 Mbit/s
sprang_webrtc 2016/11/01 18:03:16 Done.
+ BitrateAllocation();
+
+ bool SetBitrate(size_t spatial_index,
+ size_t temporal_index,
+ uint32_t bitrate_bps);
+
+ uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const;
+
+ // Get the sum of all the temporal layer for a specific spatial layer.
+ uint32_t GetSpatialLayerSum(size_t spatial_index) const;
+
+ uint32_t get_sum_bps() const { return sum_; } // Sum of all bitrates.
+ uint32_t get_sum_kbps() const { return (sum_ + 500) / 1000; }
+
+ inline bool operator==(const BitrateAllocation& other) const {
+ return memcmp(bitrates_, other.bitrates_, sizeof(bitrates_)) == 0;
+ }
+ inline bool operator!=(const BitrateAllocation& other) const {
+ return !(*this == other);
+ }
+
+ private:
+ uint32_t sum_;
+ uint32_t bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
+};
+
// Bandwidth over-use detector options. These are used to drive
// experimentation with bandwidth estimation parameters.
// See modules/remote_bitrate_estimator/overuse_detector.h

Powered by Google App Engine
This is Rietveld 408576698