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_ |
(...skipping 12 matching lines...) Expand all Loading... |
23 struct CodecSpecificInfoVP8; | 23 struct CodecSpecificInfoVP8; |
24 class Clock; | 24 class Clock; |
25 | 25 |
26 class ScreenshareLayers : public TemporalLayers { | 26 class ScreenshareLayers : public TemporalLayers { |
27 public: | 27 public: |
28 static const double kMaxTL0FpsReduction; | 28 static const double kMaxTL0FpsReduction; |
29 static const double kAcceptableTargetOvershoot; | 29 static const double kAcceptableTargetOvershoot; |
30 static const int kTl0Flags; | 30 static const int kTl0Flags; |
31 static const int kTl1Flags; | 31 static const int kTl1Flags; |
32 static const int kTl1SyncFlags; | 32 static const int kTl1SyncFlags; |
| 33 static const int kMaxFrameIntervalMs; |
33 | 34 |
34 ScreenshareLayers(int num_temporal_layers, | 35 ScreenshareLayers(int num_temporal_layers, |
35 uint8_t initial_tl0_pic_idx, | 36 uint8_t initial_tl0_pic_idx, |
36 Clock* clock); | 37 Clock* clock); |
37 virtual ~ScreenshareLayers(); | 38 virtual ~ScreenshareLayers(); |
38 | 39 |
39 // Returns the recommended VP8 encode flags needed. May refresh the decoder | 40 // Returns the recommended VP8 encode flags needed. May refresh the decoder |
40 // and/or update the reference buffers. | 41 // and/or update the reference buffers. |
41 int EncodeFlags(uint32_t timestamp) override; | 42 int EncodeFlags(uint32_t timestamp) override; |
42 | 43 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 uint32_t max_debt_bytes_; | 76 uint32_t max_debt_bytes_; |
76 int frame_rate_; | 77 int frame_rate_; |
77 | 78 |
78 static const int kMaxNumTemporalLayers = 2; | 79 static const int kMaxNumTemporalLayers = 2; |
79 struct TemporalLayer { | 80 struct TemporalLayer { |
80 TemporalLayer() | 81 TemporalLayer() |
81 : state(State::kNormal), | 82 : state(State::kNormal), |
82 enhanced_max_qp(-1), | 83 enhanced_max_qp(-1), |
83 last_qp(-1), | 84 last_qp(-1), |
84 debt_bytes_(0), | 85 debt_bytes_(0), |
85 target_rate_kbps_(0) {} | 86 target_rate_kbps_(0), |
| 87 last_emitted_timsetamp_(-1) {} |
86 | 88 |
87 enum class State { | 89 enum class State { |
88 kNormal, | 90 kNormal, |
89 kDropped, | 91 kDropped, |
90 kReencoded, | 92 kReencoded, |
91 kQualityBoost, | 93 kQualityBoost, |
92 } state; | 94 } state; |
93 | 95 |
94 int enhanced_max_qp; | 96 int enhanced_max_qp; |
95 int last_qp; | 97 int last_qp; |
96 uint32_t debt_bytes_; | 98 uint32_t debt_bytes_; |
97 uint32_t target_rate_kbps_; | 99 uint32_t target_rate_kbps_; |
| 100 int64_t last_emitted_timsetamp_; |
98 | 101 |
99 void UpdateDebt(int64_t delta_ms); | 102 void UpdateDebt(int64_t delta_ms); |
| 103 void CheckFrameInterval(int64_t timestamp); |
100 } layers_[kMaxNumTemporalLayers]; | 104 } layers_[kMaxNumTemporalLayers]; |
101 | 105 |
102 void UpdateHistograms(); | 106 void UpdateHistograms(); |
103 // Data for histogram statistics. | 107 // Data for histogram statistics. |
104 struct Stats { | 108 struct Stats { |
105 int64_t first_frame_time_ms_ = -1; | 109 int64_t first_frame_time_ms_ = -1; |
106 int64_t num_tl0_frames_ = 0; | 110 int64_t num_tl0_frames_ = 0; |
107 int64_t num_tl1_frames_ = 0; | 111 int64_t num_tl1_frames_ = 0; |
108 int64_t num_dropped_frames_ = 0; | 112 int64_t num_dropped_frames_ = 0; |
109 int64_t num_overshoots_ = 0; | 113 int64_t num_overshoots_ = 0; |
110 int64_t tl0_qp_sum_ = 0; | 114 int64_t tl0_qp_sum_ = 0; |
111 int64_t tl1_qp_sum_ = 0; | 115 int64_t tl1_qp_sum_ = 0; |
112 int64_t tl0_target_bitrate_sum_ = 0; | 116 int64_t tl0_target_bitrate_sum_ = 0; |
113 int64_t tl1_target_bitrate_sum_ = 0; | 117 int64_t tl1_target_bitrate_sum_ = 0; |
114 } stats_; | 118 } stats_; |
115 }; | 119 }; |
116 } // namespace webrtc | 120 } // namespace webrtc |
117 | 121 |
118 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ | 122 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_ |
OLD | NEW |