Chromium Code Reviews| 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..a3226a5fc8f453562eb00186e23f4f75439a54a3 |
| --- /dev/null |
| +++ b/webrtc/modules/video_coding/utility/simulcast_state.h |
| @@ -0,0 +1,59 @@ |
| +/* |
| + * 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/common_types.h" |
| + |
| +namespace webrtc { |
| + |
| +class SimulcastState { |
| + public: |
| + explicit SimulcastState(const VideoCodec& codec); |
| + virtual ~SimulcastState(); |
| + |
| + int AllocateBitrate(int target_bitrate_bps); |
| + void RequestKeyFrame(uint8_t idx); |
|
stefan-webrtc
2016/05/06 11:43:20
Could we split this class in two and have one for
|
| + bool GetAndResetKeyFrameRequest(uint8_t idx); |
| + void SetSending(uint8_t idx, bool sending); |
| + |
| + size_t NumStreams() const; |
| + size_t NumSendingStreams() const; |
| + bool IsSending(uint8_t idx) const; |
| + int AllocatedRate(uint8_t idx) const; |
| + |
| + struct Stream { |
| + Stream(uint8_t idx, VideoCodec* codec, int start_bitrate_bps); |
| + VideoCodec AsCodec() const; |
| + |
| + uint8_t idx; |
| + SimulcastStream config; |
| + int start_bitrate; |
| + VideoCodec* parent_codec; |
| + bool sending; |
| + bool keyframe_request; |
| + int allocated_rate_bps; |
| + }; |
| + const std::vector<Stream>& Streams() const; |
| + |
| + private: |
| + int IncreaseBitrateAllocation(Stream* stream, int bitrate_bps_delta); |
| + |
| + VideoCodec codec_; |
| + std::vector<Stream> streams_; |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_SIMULCAST_STATE_H_ |