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 |
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 Loading... |
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 Loading... |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 VideoCodecH264* H264(); | 632 VideoCodecH264* H264(); |
638 const VideoCodecH264& H264() const; | 633 const VideoCodecH264& H264() const; |
639 | 634 |
640 // This variable will be declared private and renamed to codec_specific_ | 635 // This variable will be declared private and renamed to codec_specific_ |
641 // once Chromium is not accessing it. | 636 // once Chromium is not accessing it. |
642 // TODO(hta): Consider replacing the union with a pointer type. | 637 // TODO(hta): Consider replacing the union with a pointer type. |
643 // This will allow removing the VideoCodec* types from this file. | 638 // This will allow removing the VideoCodec* types from this file. |
644 VideoCodecUnion codecSpecific; | 639 VideoCodecUnion codecSpecific; |
645 }; | 640 }; |
646 | 641 |
647 class BitrateAllocation { | |
648 public: | |
649 static const size_t kMaxBitrateBps; | |
650 BitrateAllocation(); | |
651 | |
652 bool SetBitrate(size_t spatial_index, | |
653 size_t temporal_index, | |
654 uint32_t bitrate_bps); | |
655 | |
656 uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const; | |
657 | |
658 // Get the sum of all the temporal layer for a specific spatial layer. | |
659 uint32_t GetSpatialLayerSum(size_t spatial_index) const; | |
660 | |
661 uint32_t get_sum_bps() const { return sum_; } // Sum of all bitrates. | |
662 uint32_t get_sum_kbps() const { return (sum_ + 500) / 1000; } | |
663 | |
664 inline bool operator==(const BitrateAllocation& other) const { | |
665 return memcmp(bitrates_, other.bitrates_, sizeof(bitrates_)) == 0; | |
666 } | |
667 inline bool operator!=(const BitrateAllocation& other) const { | |
668 return !(*this == other); | |
669 } | |
670 | |
671 private: | |
672 uint32_t sum_; | |
673 uint32_t bitrates_[kMaxSpatialLayers][kMaxTemporalStreams]; | |
674 }; | |
675 | |
676 // Bandwidth over-use detector options. These are used to drive | 642 // Bandwidth over-use detector options. These are used to drive |
677 // experimentation with bandwidth estimation parameters. | 643 // experimentation with bandwidth estimation parameters. |
678 // See modules/remote_bitrate_estimator/overuse_detector.h | 644 // See modules/remote_bitrate_estimator/overuse_detector.h |
679 struct OverUseDetectorOptions { | 645 struct OverUseDetectorOptions { |
680 OverUseDetectorOptions() | 646 OverUseDetectorOptions() |
681 : initial_slope(8.0 / 512.0), | 647 : initial_slope(8.0 / 512.0), |
682 initial_offset(0), | 648 initial_offset(0), |
683 initial_e(), | 649 initial_e(), |
684 initial_process_noise(), | 650 initial_process_noise(), |
685 initial_avg_noise(0.0), | 651 initial_avg_noise(0.0), |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 838 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
873 | 839 |
874 enum NetworkState { | 840 enum NetworkState { |
875 kNetworkUp, | 841 kNetworkUp, |
876 kNetworkDown, | 842 kNetworkDown, |
877 }; | 843 }; |
878 | 844 |
879 } // namespace webrtc | 845 } // namespace webrtc |
880 | 846 |
881 #endif // WEBRTC_COMMON_TYPES_H_ | 847 #endif // WEBRTC_COMMON_TYPES_H_ |
OLD | NEW |