OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 2 * |
| 3 * Use of this source code is governed by a BSD-style license |
| 4 * that can be found in the LICENSE file in the root of the source |
| 5 * tree. An additional intellectual property rights grant can be found |
| 6 * in the file PATENTS. All contributing project authors may |
| 7 * be found in the AUTHORS file in the root of the source tree. |
| 8 */ |
| 9 |
| 10 #ifndef WEBRTC_SCREENSHARE_LAYERS_H |
| 11 #define WEBRTC_SCREENSHARE_LAYERS_H |
| 12 |
| 13 #include "webrtc/modules/video_coding/codecs/vp9/vp9_impl.h" |
| 14 |
| 15 namespace webrtc { |
| 16 |
| 17 class ScreenshareLayersVP9 { |
| 18 public: |
| 19 explicit ScreenshareLayersVP9(uint8_t num_layers); |
| 20 |
| 21 // The target bitrate for layer with id layer_id. |
| 22 void ConfigureBitrate(int threshold_kbps, uint8_t layer_id); |
| 23 |
| 24 // The current start layer. |
| 25 uint8_t GetStartLayer() const; |
| 26 |
| 27 // Update the layer with the size of the layer frame. |
| 28 void LayerFrameEncoded(unsigned int size_bytes, uint8_t layer_id); |
| 29 |
| 30 // Get the layer settings for the next superframe. |
| 31 VP9EncoderImpl::SuperFrameRefSettings GetSuperFrameSettings( |
| 32 uint32_t timestamp, |
| 33 bool is_keyframe); |
| 34 |
| 35 private: |
| 36 uint8_t num_layers_; |
| 37 uint8_t current_layer_; |
| 38 |
| 39 // Cummulative target kbps for the different layers. |
| 40 float threshold_kbps_[kMaxVp9NumberOfSpatialLayers - 1]; |
| 41 |
| 42 // How many bits that has been used for a certain layer. Increased in |
| 43 // FrameEncoded() by the size of the encoded frame and decreased in |
| 44 // GetSuperFrameSettings() depending on the time between frames. |
| 45 float bits_used_[kMaxVp9NumberOfSpatialLayers]; |
| 46 |
| 47 // Timestamp of last frame. |
| 48 uint32_t last_ts_; |
| 49 }; |
| 50 |
| 51 } // namespace webrtc |
| 52 |
| 53 #endif // WEBRTC_SCREENSHARE_LAYERS_H |
OLD | NEW |