| 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" |
| 11 | 11 |
| 12 #include <stdlib.h> | 12 #include <stdlib.h> |
| 13 | 13 |
| 14 #include <algorithm> |
| 15 |
| 14 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 15 #include "vpx/vpx_encoder.h" | 17 #include "vpx/vpx_encoder.h" |
| 16 #include "vpx/vp8cx.h" | 18 #include "vpx/vp8cx.h" |
| 17 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 19 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| 18 | 20 |
| 19 namespace webrtc { | 21 namespace webrtc { |
| 20 | 22 |
| 21 static const int kOneSecond90Khz = 90000; | 23 static const int kOneSecond90Khz = 90000; |
| 22 static const int kMinTimeBetweenSyncs = kOneSecond90Khz * 5; | 24 static const int kMinTimeBetweenSyncs = kOneSecond90Khz * 5; |
| 23 static const int kMaxTimeBetweenSyncs = kOneSecond90Khz * 10; | 25 static const int kMaxTimeBetweenSyncs = kOneSecond90Khz * 10; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 183 |
| 182 if (active_layer_ == 0) { | 184 if (active_layer_ == 0) { |
| 183 layers_[0].debt_bytes_ += size; | 185 layers_[0].debt_bytes_ += size; |
| 184 layers_[1].debt_bytes_ += size; | 186 layers_[1].debt_bytes_ += size; |
| 185 } else if (active_layer_ == 1) { | 187 } else if (active_layer_ == 1) { |
| 186 layers_[1].debt_bytes_ += size; | 188 layers_[1].debt_bytes_ += size; |
| 187 } | 189 } |
| 188 } | 190 } |
| 189 | 191 |
| 190 void ScreenshareLayers::PopulateCodecSpecific(bool base_layer_sync, | 192 void ScreenshareLayers::PopulateCodecSpecific(bool base_layer_sync, |
| 191 CodecSpecificInfoVP8 *vp8_info, | 193 CodecSpecificInfoVP8* vp8_info, |
| 192 uint32_t timestamp) { | 194 uint32_t timestamp) { |
| 193 int64_t unwrapped_timestamp = time_wrap_handler_.Unwrap(timestamp); | 195 int64_t unwrapped_timestamp = time_wrap_handler_.Unwrap(timestamp); |
| 194 if (number_of_temporal_layers_ == 1) { | 196 if (number_of_temporal_layers_ == 1) { |
| 195 vp8_info->temporalIdx = kNoTemporalIdx; | 197 vp8_info->temporalIdx = kNoTemporalIdx; |
| 196 vp8_info->layerSync = false; | 198 vp8_info->layerSync = false; |
| 197 vp8_info->tl0PicIdx = kNoTl0PicIdx; | 199 vp8_info->tl0PicIdx = kNoTl0PicIdx; |
| 198 } else { | 200 } else { |
| 199 vp8_info->temporalIdx = active_layer_; | 201 vp8_info->temporalIdx = active_layer_; |
| 200 if (base_layer_sync) { | 202 if (base_layer_sync) { |
| 201 vp8_info->temporalIdx = 0; | 203 vp8_info->temporalIdx = 0; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 void ScreenshareLayers::TemporalLayer::UpdateDebt(int64_t delta_ms) { | 273 void ScreenshareLayers::TemporalLayer::UpdateDebt(int64_t delta_ms) { |
| 272 uint32_t debt_reduction_bytes = target_rate_kbps_ * delta_ms / 8; | 274 uint32_t debt_reduction_bytes = target_rate_kbps_ * delta_ms / 8; |
| 273 if (debt_reduction_bytes >= debt_bytes_) { | 275 if (debt_reduction_bytes >= debt_bytes_) { |
| 274 debt_bytes_ = 0; | 276 debt_bytes_ = 0; |
| 275 } else { | 277 } else { |
| 276 debt_bytes_ -= debt_reduction_bytes; | 278 debt_bytes_ -= debt_reduction_bytes; |
| 277 } | 279 } |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace webrtc | 282 } // namespace webrtc |
| OLD | NEW |