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/checks.h" | |
tommi
2016/05/20 11:34:55
Let's avoid including this header here. DCHECKs a
hta-webrtc
2016/05/20 12:11:31
Done.
| |
21 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
22 | 23 |
23 #if defined(_MSC_VER) | 24 #if defined(_MSC_VER) |
24 // Disable "new behavior: elements of array will be default initialized" | 25 // Disable "new behavior: elements of array will be default initialized" |
25 // warning. Affects OverUseDetectorOptions. | 26 // warning. Affects OverUseDetectorOptions. |
26 #pragma warning(disable:4351) | 27 #pragma warning(disable:4351) |
27 #endif | 28 #endif |
28 | 29 |
29 #ifdef WEBRTC_EXPORT | 30 #ifdef WEBRTC_EXPORT |
30 #define WEBRTC_DLLEXPORT _declspec(dllexport) | 31 #define WEBRTC_DLLEXPORT _declspec(dllexport) |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
675 int target_bitrate_bps; | 676 int target_bitrate_bps; |
676 // TODO(ivica): Add max_quantizer and min_quantizer? | 677 // TODO(ivica): Add max_quantizer and min_quantizer? |
677 }; | 678 }; |
678 | 679 |
679 enum VideoCodecMode { | 680 enum VideoCodecMode { |
680 kRealtimeVideo, | 681 kRealtimeVideo, |
681 kScreensharing | 682 kScreensharing |
682 }; | 683 }; |
683 | 684 |
684 // Common video codec properties | 685 // Common video codec properties |
685 struct VideoCodec { | 686 class VideoCodec { |
687 public: | |
688 VideoCodec(); | |
689 | |
690 // Public variables. TODO(hta): Make them private with accessors. | |
686 VideoCodecType codecType; | 691 VideoCodecType codecType; |
687 char plName[kPayloadNameSize]; | 692 char plName[kPayloadNameSize]; |
688 unsigned char plType; | 693 unsigned char plType; |
689 | 694 |
690 unsigned short width; | 695 unsigned short width; |
691 unsigned short height; | 696 unsigned short height; |
692 | 697 |
693 unsigned int startBitrate; // kilobits/sec. | 698 unsigned int startBitrate; // kilobits/sec. |
694 unsigned int maxBitrate; // kilobits/sec. | 699 unsigned int maxBitrate; // kilobits/sec. |
695 unsigned int minBitrate; // kilobits/sec. | 700 unsigned int minBitrate; // kilobits/sec. |
696 unsigned int targetBitrate; // kilobits/sec. | 701 unsigned int targetBitrate; // kilobits/sec. |
697 | 702 |
698 unsigned char maxFramerate; | 703 unsigned char maxFramerate; |
699 | 704 |
700 VideoCodecUnion codecSpecific; | |
701 | |
702 unsigned int qpMax; | 705 unsigned int qpMax; |
703 unsigned char numberOfSimulcastStreams; | 706 unsigned char numberOfSimulcastStreams; |
704 SimulcastStream simulcastStream[kMaxSimulcastStreams]; | 707 SimulcastStream simulcastStream[kMaxSimulcastStreams]; |
705 SpatialLayer spatialLayers[kMaxSpatialLayers]; | 708 SpatialLayer spatialLayers[kMaxSpatialLayers]; |
706 | 709 |
707 VideoCodecMode mode; | 710 VideoCodecMode mode; |
708 | 711 |
709 bool operator==(const VideoCodec& other) const = delete; | 712 bool operator==(const VideoCodec& other) const = delete; |
710 bool operator!=(const VideoCodec& other) const = delete; | 713 bool operator!=(const VideoCodec& other) const = delete; |
714 | |
715 // Accessors for codec specific information. | |
716 // There is a const version of each that returns a reference, | |
717 // and a non-const version that returns a pointer, in order | |
718 // to allow modification of the parameters. | |
719 VideoCodecVP8* VP8() { | |
tommi
2016/05/20 11:34:55
move all of these to a source file
hta-webrtc
2016/05/20 12:11:31
Done.
| |
720 RTC_CHECK(codecType == kVideoCodecVP8); | |
tommi
2016/05/20 11:34:55
I notice that some of these are CHECK while others
hta-webrtc
2016/05/20 12:11:31
Done.
| |
721 return &codecSpecific_.VP8; | |
722 } | |
723 const VideoCodecVP8& VP8() const { | |
724 RTC_CHECK(codecType == kVideoCodecVP8); | |
725 return codecSpecific_.VP8; | |
726 } | |
727 VideoCodecVP9* VP9() { | |
728 RTC_DCHECK(codecType == kVideoCodecVP9); | |
729 return &codecSpecific_.VP9; | |
730 } | |
731 const VideoCodecVP9& VP9() const { | |
732 RTC_DCHECK(codecType == kVideoCodecVP9); | |
733 return codecSpecific_.VP9; | |
734 } | |
735 VideoCodecH264* H264() { | |
736 RTC_DCHECK(codecType == kVideoCodecH264); | |
737 return &codecSpecific_.H264; | |
738 } | |
739 const VideoCodecH264& H264() const { | |
740 RTC_DCHECK(codecType == kVideoCodecH264); | |
741 return codecSpecific_.H264; | |
742 } | |
743 | |
744 private: | |
745 // TODO(hta): Consider replacing the union with a pointer type. | |
tommi
2016/05/20 11:34:55
having an extra pointer might not be worth it. I
hta-webrtc
2016/05/20 12:11:31
Acknowledged.
Although I remember 2 years ago tha
pbos-webrtc
2016/05/20 12:26:24
If that's the case, then I think it makes more sen
| |
746 // This will allow removing the VideoCodec* types from this file. | |
747 VideoCodecUnion codecSpecific_; | |
tommi
2016/05/20 11:34:55
since you're changing the name according to the st
hta-webrtc
2016/05/20 12:11:31
Done.
| |
711 }; | 748 }; |
712 | 749 |
713 // Bandwidth over-use detector options. These are used to drive | 750 // Bandwidth over-use detector options. These are used to drive |
714 // experimentation with bandwidth estimation parameters. | 751 // experimentation with bandwidth estimation parameters. |
715 // See modules/remote_bitrate_estimator/overuse_detector.h | 752 // See modules/remote_bitrate_estimator/overuse_detector.h |
716 struct OverUseDetectorOptions { | 753 struct OverUseDetectorOptions { |
717 OverUseDetectorOptions() | 754 OverUseDetectorOptions() |
718 : initial_slope(8.0/512.0), | 755 : initial_slope(8.0/512.0), |
719 initial_offset(0), | 756 initial_offset(0), |
720 initial_e(), | 757 initial_e(), |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
893 enum class RtcpMode { kOff, kCompound, kReducedSize }; | 930 enum class RtcpMode { kOff, kCompound, kReducedSize }; |
894 | 931 |
895 enum NetworkState { | 932 enum NetworkState { |
896 kNetworkUp, | 933 kNetworkUp, |
897 kNetworkDown, | 934 kNetworkDown, |
898 }; | 935 }; |
899 | 936 |
900 } // namespace webrtc | 937 } // namespace webrtc |
901 | 938 |
902 #endif // WEBRTC_COMMON_TYPES_H_ | 939 #endif // WEBRTC_COMMON_TYPES_H_ |
OLD | NEW |