OLD | NEW |
1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
2 * | 2 * |
3 * Use of this source code is governed by a BSD-style license | 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 | 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 | 5 * tree. An additional intellectual property rights grant can be found |
6 * in the file PATENTS. All contributing project authors may | 6 * in the file PATENTS. All contributing project authors may |
7 * be found in the AUTHORS file in the root of the source tree. | 7 * be found in the AUTHORS file in the root of the source tree. |
8 */ | 8 */ |
9 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ | 9 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ |
10 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ | 10 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ |
11 | 11 |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "webrtc/base/rate_statistics.h" | 14 #include "webrtc/base/rate_statistics.h" |
15 #include "webrtc/base/timeutils.h" | 15 #include "webrtc/base/timeutils.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" | 16 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
17 #include "webrtc/modules/video_coding/utility/frame_dropper.h" | 17 #include "webrtc/modules/video_coding/utility/frame_dropper.h" |
18 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 struct CodecSpecificInfoVP8; | 22 struct CodecSpecificInfoVP8; |
23 class Clock; | 23 class Clock; |
24 | 24 |
25 class ScreenshareLayers : public TemporalLayers { | 25 class ScreenshareLayers : public TemporalLayers { |
26 public: | 26 public: |
27 static const double kMaxTL0FpsReduction; | 27 static const double kMaxTL0FpsReduction; |
28 static const double kAcceptableTargetOvershoot; | 28 static const double kAcceptableTargetOvershoot; |
29 static const int kTl0Flags; | |
30 static const int kTl1Flags; | |
31 static const int kTl1SyncFlags; | |
32 static const int kMaxFrameIntervalMs; | 29 static const int kMaxFrameIntervalMs; |
33 | 30 |
34 ScreenshareLayers(int num_temporal_layers, | 31 ScreenshareLayers(int num_temporal_layers, |
35 uint8_t initial_tl0_pic_idx, | 32 uint8_t initial_tl0_pic_idx, |
36 Clock* clock); | 33 Clock* clock); |
37 virtual ~ScreenshareLayers(); | 34 virtual ~ScreenshareLayers(); |
38 | 35 |
39 // Returns the recommended VP8 encode flags needed. May refresh the decoder | 36 // Returns the recommended VP8 encode flags needed. May refresh the decoder |
40 // and/or update the reference buffers. | 37 // and/or update the reference buffers. |
41 int EncodeFlags(uint32_t timestamp) override; | 38 TemporalReferences GetLayerConfig(uint32_t timestamp) override; |
42 | 39 |
43 // Update state based on new bitrate target and incoming framerate. | 40 // Update state based on new bitrate target and incoming framerate. |
44 // Returns the bitrate allocation for the active temporal layers. | 41 // Returns the bitrate allocation for the active temporal layers. |
45 std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps, | 42 std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps, |
46 int max_bitrate_kbps, | 43 int max_bitrate_kbps, |
47 int framerate) override; | 44 int framerate) override; |
48 | 45 |
49 // Update the encoder configuration with target bitrates or other parameters. | 46 // Update the encoder configuration with target bitrates or other parameters. |
50 // Returns true iff the configuration was actually modified. | 47 // Returns true iff the configuration was actually modified. |
51 bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override; | 48 bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override; |
52 | 49 |
53 void PopulateCodecSpecific(bool base_layer_sync, | 50 void PopulateCodecSpecific(bool base_layer_sync, |
54 CodecSpecificInfoVP8* vp8_info, | 51 CodecSpecificInfoVP8* vp8_info, |
55 uint32_t timestamp) override; | 52 uint32_t timestamp) override; |
56 | 53 |
57 void FrameEncoded(unsigned int size, uint32_t timestamp, int qp) override; | 54 void FrameEncoded(unsigned int size, int qp) override; |
58 | 55 |
59 int CurrentLayerId() const override; | 56 int CurrentLayerId() const override; |
60 | 57 |
61 private: | 58 private: |
62 bool TimeToSync(int64_t timestamp) const; | 59 bool TimeToSync(int64_t timestamp) const; |
63 uint32_t GetCodecTargetBitrateKbps() const; | 60 uint32_t GetCodecTargetBitrateKbps() const; |
64 | 61 |
65 Clock* const clock_; | 62 Clock* const clock_; |
66 | 63 |
67 int number_of_temporal_layers_; | 64 int number_of_temporal_layers_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 int64_t num_overshoots_ = 0; | 115 int64_t num_overshoots_ = 0; |
119 int64_t tl0_qp_sum_ = 0; | 116 int64_t tl0_qp_sum_ = 0; |
120 int64_t tl1_qp_sum_ = 0; | 117 int64_t tl1_qp_sum_ = 0; |
121 int64_t tl0_target_bitrate_sum_ = 0; | 118 int64_t tl0_target_bitrate_sum_ = 0; |
122 int64_t tl1_target_bitrate_sum_ = 0; | 119 int64_t tl1_target_bitrate_sum_ = 0; |
123 } stats_; | 120 } stats_; |
124 }; | 121 }; |
125 } // namespace webrtc | 122 } // namespace webrtc |
126 | 123 |
127 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ | 124 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ |
OLD | NEW |