Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: webrtc/common_types.h

Issue 2434073003: Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Fixed sign mismatch Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 bool pictureLossIndicationOn; 517 bool pictureLossIndicationOn;
518 bool feedbackModeOn; 518 bool feedbackModeOn;
519 VideoCodecComplexity complexity; 519 VideoCodecComplexity complexity;
520 VP8ResilienceMode resilience; 520 VP8ResilienceMode resilience;
521 unsigned char numberOfTemporalLayers; 521 unsigned char numberOfTemporalLayers;
522 bool denoisingOn; 522 bool denoisingOn;
523 bool errorConcealmentOn; 523 bool errorConcealmentOn;
524 bool automaticResizeOn; 524 bool automaticResizeOn;
525 bool frameDroppingOn; 525 bool frameDroppingOn;
526 int keyFrameInterval; 526 int keyFrameInterval;
527 const TemporalLayersFactory* tl_factory; 527 TemporalLayersFactory* tl_factory;
528 }; 528 };
529 529
530 // VP9 specific. 530 // VP9 specific.
531 struct VideoCodecVP9 { 531 struct VideoCodecVP9 {
532 VideoCodecComplexity complexity; 532 VideoCodecComplexity complexity;
533 int resilience; 533 int resilience;
534 unsigned char numberOfTemporalLayers; 534 unsigned char numberOfTemporalLayers;
535 bool denoisingOn; 535 bool denoisingOn;
536 bool frameDroppingOn; 536 bool frameDroppingOn;
537 int keyFrameInterval; 537 int keyFrameInterval;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 class BitrateAllocation {
626 public:
627 static constexpr size_t kMaxBitrateBps = 100000000;
perkj_webrtc 2016/10/27 12:57:31 nit : add comment 100 Mbit/s
sprang_webrtc 2016/11/01 18:03:16 Done.
628 BitrateAllocation();
629
630 bool SetBitrate(size_t spatial_index,
631 size_t temporal_index,
632 uint32_t bitrate_bps);
633
634 uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const;
635
636 // Get the sum of all the temporal layer for a specific spatial layer.
637 uint32_t GetSpatialLayerSum(size_t spatial_index) const;
638
639 uint32_t get_sum_bps() const { return sum_; } // Sum of all bitrates.
640 uint32_t get_sum_kbps() const { return (sum_ + 500) / 1000; }
641
642 inline bool operator==(const BitrateAllocation& other) const {
643 return memcmp(bitrates_, other.bitrates_, sizeof(bitrates_)) == 0;
644 }
645 inline bool operator!=(const BitrateAllocation& other) const {
646 return !(*this == other);
647 }
648
649 private:
650 uint32_t sum_;
651 uint32_t bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
652 };
653
625 // Bandwidth over-use detector options. These are used to drive 654 // Bandwidth over-use detector options. These are used to drive
626 // experimentation with bandwidth estimation parameters. 655 // experimentation with bandwidth estimation parameters.
627 // See modules/remote_bitrate_estimator/overuse_detector.h 656 // See modules/remote_bitrate_estimator/overuse_detector.h
628 struct OverUseDetectorOptions { 657 struct OverUseDetectorOptions {
629 OverUseDetectorOptions() 658 OverUseDetectorOptions()
630 : initial_slope(8.0 / 512.0), 659 : initial_slope(8.0 / 512.0),
631 initial_offset(0), 660 initial_offset(0),
632 initial_e(), 661 initial_e(),
633 initial_process_noise(), 662 initial_process_noise(),
634 initial_avg_noise(0.0), 663 initial_avg_noise(0.0),
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 enum class RtcpMode { kOff, kCompound, kReducedSize }; 850 enum class RtcpMode { kOff, kCompound, kReducedSize };
822 851
823 enum NetworkState { 852 enum NetworkState {
824 kNetworkUp, 853 kNetworkUp,
825 kNetworkDown, 854 kNetworkDown,
826 }; 855 };
827 856
828 } // namespace webrtc 857 } // namespace webrtc
829 858
830 #endif // WEBRTC_COMMON_TYPES_H_ 859 #endif // WEBRTC_COMMON_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698