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

Side by Side Diff: webrtc/common_types.h

Issue 2491393002: Revert of Issue 2434073003: Extract bitrate allocation ... (Closed)
Patch Set: 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
« no previous file with comments | « webrtc/call/call_perf_tests.cc ('k') | webrtc/common_types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #ifndef WEBRTC_COMMON_TYPES_H_ 11 #ifndef WEBRTC_COMMON_TYPES_H_
12 #define WEBRTC_COMMON_TYPES_H_ 12 #define WEBRTC_COMMON_TYPES_H_
13 13
14 #include <assert.h> 14 #include <assert.h>
15 #include <stddef.h> 15 #include <stddef.h>
16 #include <string.h> 16 #include <string.h>
17 17
18 #include <string> 18 #include <string>
19 #include <vector> 19 #include <vector>
20 20
21 #include "webrtc/base/optional.h"
22 #include "webrtc/common_video/rotation.h" 21 #include "webrtc/common_video/rotation.h"
23 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
24 23
25 #if defined(_MSC_VER) 24 #if defined(_MSC_VER)
26 // Disable "new behavior: elements of array will be default initialized" 25 // Disable "new behavior: elements of array will be default initialized"
27 // warning. Affects OverUseDetectorOptions. 26 // warning. Affects OverUseDetectorOptions.
28 #pragma warning(disable : 4351) 27 #pragma warning(disable : 4351)
29 #endif 28 #endif
30 29
31 #if defined(WEBRTC_EXPORT) 30 #if defined(WEBRTC_EXPORT)
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 bool pictureLossIndicationOn; 515 bool pictureLossIndicationOn;
517 bool feedbackModeOn; 516 bool feedbackModeOn;
518 VideoCodecComplexity complexity; 517 VideoCodecComplexity complexity;
519 VP8ResilienceMode resilience; 518 VP8ResilienceMode resilience;
520 unsigned char numberOfTemporalLayers; 519 unsigned char numberOfTemporalLayers;
521 bool denoisingOn; 520 bool denoisingOn;
522 bool errorConcealmentOn; 521 bool errorConcealmentOn;
523 bool automaticResizeOn; 522 bool automaticResizeOn;
524 bool frameDroppingOn; 523 bool frameDroppingOn;
525 int keyFrameInterval; 524 int keyFrameInterval;
526 TemporalLayersFactory* tl_factory; 525 const TemporalLayersFactory* tl_factory;
527 }; 526 };
528 527
529 // VP9 specific. 528 // VP9 specific.
530 struct VideoCodecVP9 { 529 struct VideoCodecVP9 {
531 VideoCodecComplexity complexity; 530 VideoCodecComplexity complexity;
532 int resilience; 531 int resilience;
533 unsigned char numberOfTemporalLayers; 532 unsigned char numberOfTemporalLayers;
534 bool denoisingOn; 533 bool denoisingOn;
535 bool frameDroppingOn; 534 bool frameDroppingOn;
536 int keyFrameInterval; 535 int keyFrameInterval;
(...skipping 20 matching lines...) Expand all
557 kVideoCodecVP9, 556 kVideoCodecVP9,
558 kVideoCodecH264, 557 kVideoCodecH264,
559 kVideoCodecI420, 558 kVideoCodecI420,
560 kVideoCodecRED, 559 kVideoCodecRED,
561 kVideoCodecULPFEC, 560 kVideoCodecULPFEC,
562 kVideoCodecFlexfec, 561 kVideoCodecFlexfec,
563 kVideoCodecGeneric, 562 kVideoCodecGeneric,
564 kVideoCodecUnknown 563 kVideoCodecUnknown
565 }; 564 };
566 565
567 // Translates from name of codec to codec type and vice versa.
568 rtc::Optional<std::string> CodecTypeToPayloadName(VideoCodecType type);
569 rtc::Optional<VideoCodecType> PayloadNameToCodecType(const std::string& name);
570
571 union VideoCodecUnion { 566 union VideoCodecUnion {
572 VideoCodecVP8 VP8; 567 VideoCodecVP8 VP8;
573 VideoCodecVP9 VP9; 568 VideoCodecVP9 VP9;
574 VideoCodecH264 H264; 569 VideoCodecH264 H264;
575 }; 570 };
576 571
577 // Simulcast is when the same stream is encoded multiple times with different 572 // Simulcast is when the same stream is encoded multiple times with different
578 // settings such as resolution. 573 // settings such as resolution.
579 struct SimulcastStream { 574 struct SimulcastStream {
580 unsigned short width; 575 unsigned short width;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 const VideoCodecVP9& VP9() const; 631 const VideoCodecVP9& VP9() const;
637 VideoCodecH264* H264(); 632 VideoCodecH264* H264();
638 const VideoCodecH264& H264() const; 633 const VideoCodecH264& H264() const;
639 634
640 private: 635 private:
641 // TODO(hta): Consider replacing the union with a pointer type. 636 // TODO(hta): Consider replacing the union with a pointer type.
642 // This will allow removing the VideoCodec* types from this file. 637 // This will allow removing the VideoCodec* types from this file.
643 VideoCodecUnion codec_specific_; 638 VideoCodecUnion codec_specific_;
644 }; 639 };
645 640
646 class BitrateAllocation {
647 public:
648 static const size_t kMaxBitrateBps;
649 BitrateAllocation();
650
651 bool SetBitrate(size_t spatial_index,
652 size_t temporal_index,
653 uint32_t bitrate_bps);
654
655 uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const;
656
657 // Get the sum of all the temporal layer for a specific spatial layer.
658 uint32_t GetSpatialLayerSum(size_t spatial_index) const;
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_;
672 uint32_t bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
673 };
674
675 // Bandwidth over-use detector options. These are used to drive 641 // Bandwidth over-use detector options. These are used to drive
676 // experimentation with bandwidth estimation parameters. 642 // experimentation with bandwidth estimation parameters.
677 // See modules/remote_bitrate_estimator/overuse_detector.h 643 // See modules/remote_bitrate_estimator/overuse_detector.h
678 struct OverUseDetectorOptions { 644 struct OverUseDetectorOptions {
679 OverUseDetectorOptions() 645 OverUseDetectorOptions()
680 : initial_slope(8.0 / 512.0), 646 : initial_slope(8.0 / 512.0),
681 initial_offset(0), 647 initial_offset(0),
682 initial_e(), 648 initial_e(),
683 initial_process_noise(), 649 initial_process_noise(),
684 initial_avg_noise(0.0), 650 initial_avg_noise(0.0),
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 enum class RtcpMode { kOff, kCompound, kReducedSize }; 837 enum class RtcpMode { kOff, kCompound, kReducedSize };
872 838
873 enum NetworkState { 839 enum NetworkState {
874 kNetworkUp, 840 kNetworkUp,
875 kNetworkDown, 841 kNetworkDown,
876 }; 842 };
877 843
878 } // namespace webrtc 844 } // namespace webrtc
879 845
880 #endif // WEBRTC_COMMON_TYPES_H_ 846 #endif // WEBRTC_COMMON_TYPES_H_
OLDNEW
« no previous file with comments | « webrtc/call/call_perf_tests.cc ('k') | webrtc/common_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698