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 | 9 |
10 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" | 10 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 last_base_layer_sync_ = base_layer_sync; | 213 last_base_layer_sync_ = base_layer_sync; |
214 vp8_info->tl0PicIdx = tl0_pic_idx_; | 214 vp8_info->tl0PicIdx = tl0_pic_idx_; |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 bool ScreenshareLayers::TimeToSync(int64_t timestamp) const { | 218 bool ScreenshareLayers::TimeToSync(int64_t timestamp) const { |
219 if (active_layer_ != 1) { | 219 if (active_layer_ != 1) { |
220 RTC_NOTREACHED(); | 220 RTC_NOTREACHED(); |
221 return false; | 221 return false; |
222 } | 222 } |
223 DCHECK_NE(-1, layers_[0].last_qp); | 223 RTC_DCHECK_NE(-1, layers_[0].last_qp); |
224 if (layers_[1].last_qp == -1) { | 224 if (layers_[1].last_qp == -1) { |
225 // First frame in TL1 should only depend on TL0 since there are no | 225 // First frame in TL1 should only depend on TL0 since there are no |
226 // previous frames in TL1. | 226 // previous frames in TL1. |
227 return true; | 227 return true; |
228 } | 228 } |
229 | 229 |
230 DCHECK_NE(-1, last_sync_timestamp_); | 230 RTC_DCHECK_NE(-1, last_sync_timestamp_); |
231 int64_t timestamp_diff = timestamp - last_sync_timestamp_; | 231 int64_t timestamp_diff = timestamp - last_sync_timestamp_; |
232 if (timestamp_diff > kMaxTimeBetweenSyncs) { | 232 if (timestamp_diff > kMaxTimeBetweenSyncs) { |
233 // After a certain time, force a sync frame. | 233 // After a certain time, force a sync frame. |
234 return true; | 234 return true; |
235 } else if (timestamp_diff < kMinTimeBetweenSyncs) { | 235 } else if (timestamp_diff < kMinTimeBetweenSyncs) { |
236 // If too soon from previous sync frame, don't issue a new one. | 236 // If too soon from previous sync frame, don't issue a new one. |
237 return false; | 237 return false; |
238 } | 238 } |
239 // Issue a sync frame if difference in quality between TL0 and TL1 isn't too | 239 // Issue a sync frame if difference in quality between TL0 and TL1 isn't too |
240 // large. | 240 // large. |
(...skipping 30 matching lines...) Expand all Loading... |
271 void ScreenshareLayers::TemporalLayer::UpdateDebt(int64_t delta_ms) { | 271 void ScreenshareLayers::TemporalLayer::UpdateDebt(int64_t delta_ms) { |
272 uint32_t debt_reduction_bytes = target_rate_kbps_ * delta_ms / 8; | 272 uint32_t debt_reduction_bytes = target_rate_kbps_ * delta_ms / 8; |
273 if (debt_reduction_bytes >= debt_bytes_) { | 273 if (debt_reduction_bytes >= debt_bytes_) { |
274 debt_bytes_ = 0; | 274 debt_bytes_ = 0; |
275 } else { | 275 } else { |
276 debt_bytes_ -= debt_reduction_bytes; | 276 debt_bytes_ -= debt_reduction_bytes; |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 } // namespace webrtc | 280 } // namespace webrtc |
OLD | NEW |