Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 SimulcastStream simulcastStream[kMaxSimulcastStreams]; | 615 SimulcastStream simulcastStream[kMaxSimulcastStreams]; |
| 616 SpatialLayer spatialLayers[kMaxSpatialLayers]; | 616 SpatialLayer spatialLayers[kMaxSpatialLayers]; |
| 617 | 617 |
| 618 VideoCodecMode mode; | 618 VideoCodecMode mode; |
| 619 bool expect_encode_from_texture; | 619 bool expect_encode_from_texture; |
| 620 | 620 |
| 621 bool operator==(const VideoCodec& other) const = delete; | 621 bool operator==(const VideoCodec& other) const = delete; |
| 622 bool operator!=(const VideoCodec& other) const = delete; | 622 bool operator!=(const VideoCodec& other) const = delete; |
| 623 }; | 623 }; |
| 624 | 624 |
| 625 struct BitrateAllocation { | |
|
perkj_webrtc
2016/10/21 08:24:28
please use class.
sprang_webrtc
2016/10/25 10:44:25
Agreed. This started out as a simple struct (that'
| |
| 626 static const size_t kMaxBitrateBps = 100000000; | |
| 627 BitrateAllocation() = default; | |
| 628 | |
| 629 bool set_bitrate(size_t spatial_index, | |
| 630 size_t temporal_index, | |
| 631 uint32_t bitrate_bps) { | |
| 632 assert(spatial_index < kMaxSpatialLayers); | |
|
perkj_webrtc
2016/10/21 08:24:28
CHECK or DCHECK instead of assert.
sprang_webrtc
2016/10/25 10:44:25
For some reason, everything here used assert and c
| |
| 633 assert(temporal_index < kMaxTemporalStreams); | |
| 634 if (bitrate_bps > kMaxBitrateBps || | |
| 635 sum - bitrates[spatial_index][temporal_index] + bitrate_bps > | |
| 636 kMaxBitrateBps) { | |
| 637 return false; | |
| 638 } | |
| 639 sum -= bitrates[spatial_index][temporal_index]; | |
|
perkj_webrtc
2016/10/21 08:24:28
please move implementation to a cc file.
sprang_webrtc
2016/10/25 10:44:25
Done.
| |
| 640 bitrates[spatial_index][temporal_index] = bitrate_bps; | |
| 641 sum += bitrate_bps; | |
| 642 return true; | |
| 643 } | |
| 644 | |
| 645 uint32_t get_bitrate(size_t spatial_index, size_t temporal_index) const { | |
| 646 assert(spatial_index < kMaxSpatialLayers); | |
|
perkj_webrtc
2016/10/21 08:24:28
dito
sprang_webrtc
2016/10/25 10:44:25
Done.
| |
| 647 assert(temporal_index < kMaxSimulcastStreams); | |
| 648 return bitrates[spatial_index][temporal_index]; | |
| 649 } | |
| 650 | |
| 651 // Get the sum of all the temporal layer for a specific spatial layer. | |
| 652 uint32_t get_spatial_layer_sum(size_t spatial_index) const { | |
| 653 assert(spatial_index < kMaxSpatialLayers); | |
| 654 uint32_t sum = 0; | |
| 655 for (int i = 0; i < kMaxTemporalStreams; ++i) | |
| 656 sum += bitrates[spatial_index][i]; | |
| 657 return sum; | |
| 658 } | |
| 659 | |
| 660 uint32_t get_sum_bps() const { return sum; } // Sum of all bitrates. | |
| 661 uint32_t get_sum_kbps() const { return (sum + 500) / 1000; } | |
| 662 | |
| 663 inline bool operator==(const BitrateAllocation& other) const { | |
| 664 return memcmp(bitrates, other.bitrates, sizeof(bitrates)) == 0; | |
| 665 } | |
| 666 inline bool operator!=(const BitrateAllocation& other) const { | |
| 667 return !(*this == other); | |
| 668 } | |
| 669 | |
| 670 private: | |
| 671 uint32_t sum = 0; | |
|
perkj_webrtc
2016/10/21 08:24:28
sum_
sprang_webrtc
2016/10/25 10:44:25
Done.
| |
| 672 uint32_t bitrates[kMaxSpatialLayers][kMaxTemporalStreams] = {}; | |
|
perkj_webrtc
2016/10/21 08:24:28
bitrates_
sprang_webrtc
2016/10/25 10:44:25
Done.
| |
| 673 }; | |
| 674 | |
| 625 // Bandwidth over-use detector options. These are used to drive | 675 // Bandwidth over-use detector options. These are used to drive |
| 626 // experimentation with bandwidth estimation parameters. | 676 // experimentation with bandwidth estimation parameters. |
| 627 // See modules/remote_bitrate_estimator/overuse_detector.h | 677 // See modules/remote_bitrate_estimator/overuse_detector.h |
| 628 struct OverUseDetectorOptions { | 678 struct OverUseDetectorOptions { |
| 629 OverUseDetectorOptions() | 679 OverUseDetectorOptions() |
| 630 : initial_slope(8.0 / 512.0), | 680 : initial_slope(8.0 / 512.0), |
| 631 initial_offset(0), | 681 initial_offset(0), |
| 632 initial_e(), | 682 initial_e(), |
| 633 initial_process_noise(), | 683 initial_process_noise(), |
| 634 initial_avg_noise(0.0), | 684 initial_avg_noise(0.0), |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 871 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
| 822 | 872 |
| 823 enum NetworkState { | 873 enum NetworkState { |
| 824 kNetworkUp, | 874 kNetworkUp, |
| 825 kNetworkDown, | 875 kNetworkDown, |
| 826 }; | 876 }; |
| 827 | 877 |
| 828 } // namespace webrtc | 878 } // namespace webrtc |
| 829 | 879 |
| 830 #endif // WEBRTC_COMMON_TYPES_H_ | 880 #endif // WEBRTC_COMMON_TYPES_H_ |
| OLD | NEW |