OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 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 | |
12 #ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ | |
13 #define WEBRTC_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ | |
14 | |
15 #include <vector> | |
16 | |
17 #include "webrtc/base/constructormagic.h" | |
18 #include "webrtc/common_types.h" | |
19 | |
20 namespace webrtc { | |
21 | |
22 class SimulcastState { | |
23 public: | |
24 explicit SimulcastState(const VideoCodec& codec); | |
25 virtual ~SimulcastState(); | |
26 | |
27 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
| |
28 void RequestKeyFrame(uint8_t idx); | |
pbos-webrtc
2016/04/29 21:23:27
Do we ever actually use the index here? Seems to m
| |
29 bool GetAndResetKeyFrameRequest(uint8_t idx); | |
30 void SetSending(uint8_t idx, bool sending); | |
31 | |
32 std::vector<int> GetStreamRates() const; | |
33 int SumMaxBitrate() const; | |
34 int SumTargetBitrate() const; | |
35 int SumAllocatedBitrate() const; | |
36 size_t NumStreams() const; | |
37 size_t NumSendingStreams() const; | |
38 bool AnyKeyFrameRequested() const; | |
39 bool IsSending(uint8_t idx) const; | |
40 int AllocatedRate(uint8_t idx) const; | |
41 | |
42 struct Stream { | |
43 Stream(uint8_t idx, VideoCodec* codec, int start_bitrate); | |
44 VideoCodec AsCodec() const; | |
45 | |
46 uint8_t idx; | |
47 SimulcastStream config; | |
48 int start_bitrate; | |
49 VideoCodec* parent_codec; | |
50 bool sending; | |
51 bool keyframe_request; | |
52 int allocated_rate_kbps; | |
pbos-webrtc
2016/04/29 21:23:27
including here
| |
53 }; | |
54 | |
55 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()
| |
56 std::vector<Stream>::const_iterator end() const { return streams_.end(); } | |
57 | |
58 private: | |
59 int IncreaseBitrateAllocation(Stream* stream, int bitrate_kbps_delta); | |
60 | |
61 VideoCodec codec_; | |
62 int sum_max_bitrate_; | |
63 int sum_target_bitrate_; | |
64 int sum_allocated_bitrate_; | |
65 std::vector<Stream> streams_; | |
66 | |
67 RTC_DISALLOW_COPY_AND_ASSIGN(SimulcastState); | |
68 }; | |
69 | |
70 } // namespace webrtc | |
71 | |
72 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ | |
OLD | NEW |