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

Unified Diff: webrtc/modules/video_coding/utility/simulcast_state.h

Issue 1913073002: Extract common simulcast logic from VP8 wrapper and simulcast adapter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Bug fix Created 4 years, 8 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/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_

Powered by Google App Engine
This is Rietveld 408576698