Index: webrtc/modules/video_coding/utility/simulcast_state.h |
diff --git a/webrtc/modules/video_coding/utility/simulcast_state.h b/webrtc/modules/video_coding/utility/simulcast_state.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5a9e6f22a50e54f1c38263a5b2e96115a9a10fea |
--- /dev/null |
+++ b/webrtc/modules/video_coding/utility/simulcast_state.h |
@@ -0,0 +1,72 @@ |
+/* |
+ * Copyright (c) 2016 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_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ |
+#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ |
+ |
+#include <vector> |
+ |
+#include "webrtc/base/constructormagic.h" |
+#include "webrtc/common_types.h" |
+ |
+namespace webrtc { |
+ |
+class SimulcastState { |
+ public: |
+ explicit SimulcastState(const VideoCodec& codec); |
+ virtual ~SimulcastState(); |
+ |
+ int AllocateBitrate(int target_bitrate_kbps); |
pbos-webrtc
2016/04/29 21:23:27
Can we make all of these _bps instead and move in
|
+ void RequestKeyFrame(uint8_t idx); |
pbos-webrtc
2016/04/29 21:23:27
Do we ever actually use the index here? Seems to m
|
+ bool GetAndResetKeyFrameRequest(uint8_t idx); |
+ void SetSending(uint8_t idx, bool sending); |
+ |
+ std::vector<int> GetStreamRates() const; |
+ int SumMaxBitrate() const; |
+ int SumTargetBitrate() const; |
+ int SumAllocatedBitrate() const; |
+ size_t NumStreams() const; |
+ size_t NumSendingStreams() const; |
+ bool AnyKeyFrameRequested() const; |
+ bool IsSending(uint8_t idx) const; |
+ int AllocatedRate(uint8_t idx) const; |
+ |
+ struct Stream { |
+ Stream(uint8_t idx, VideoCodec* codec, int start_bitrate); |
+ VideoCodec AsCodec() const; |
+ |
+ uint8_t idx; |
+ SimulcastStream config; |
+ int start_bitrate; |
+ VideoCodec* parent_codec; |
+ bool sending; |
+ bool keyframe_request; |
+ int allocated_rate_kbps; |
pbos-webrtc
2016/04/29 21:23:27
including here
|
+ }; |
+ |
+ std::vector<Stream>::const_iterator begin() const { return streams_.begin(); } |
pbos-webrtc
2016/04/29 21:23:27
Replace with const std::vector<Stream>& streams()
|
+ std::vector<Stream>::const_iterator end() const { return streams_.end(); } |
+ |
+ private: |
+ int IncreaseBitrateAllocation(Stream* stream, int bitrate_kbps_delta); |
+ |
+ VideoCodec codec_; |
+ int sum_max_bitrate_; |
+ int sum_target_bitrate_; |
+ int sum_allocated_bitrate_; |
+ std::vector<Stream> streams_; |
+ |
+ RTC_DISALLOW_COPY_AND_ASSIGN(SimulcastState); |
+}; |
+ |
+} // namespace webrtc |
+ |
+#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ |