Chromium Code Reviews| Index: webrtc/common_types.h | 
| diff --git a/webrtc/common_types.h b/webrtc/common_types.h | 
| index 587b90d753ce3f3eb092dfd01edb8b1b68303719..0cb0f3ed780fa5cd3282e54ff78cac3ad291182e 100644 | 
| --- a/webrtc/common_types.h | 
| +++ b/webrtc/common_types.h | 
| @@ -18,6 +18,7 @@ | 
| #include <string> | 
| #include <vector> | 
| +#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.
 
 | 
| #include "webrtc/typedefs.h" | 
| #if defined(_MSC_VER) | 
| @@ -682,7 +683,11 @@ enum VideoCodecMode { | 
| }; | 
| // Common video codec properties | 
| -struct VideoCodec { | 
| +class VideoCodec { | 
| + public: | 
| + VideoCodec(); | 
| + | 
| + // Public variables. TODO(hta): Make them private with accessors. | 
| VideoCodecType codecType; | 
| char plName[kPayloadNameSize]; | 
| unsigned char plType; | 
| @@ -697,8 +702,6 @@ struct VideoCodec { | 
| unsigned char maxFramerate; | 
| - VideoCodecUnion codecSpecific; | 
| - | 
| unsigned int qpMax; | 
| unsigned char numberOfSimulcastStreams; | 
| SimulcastStream simulcastStream[kMaxSimulcastStreams]; | 
| @@ -708,6 +711,40 @@ struct VideoCodec { | 
| bool operator==(const VideoCodec& other) const = delete; | 
| bool operator!=(const VideoCodec& other) const = delete; | 
| + | 
| + // Accessors for codec specific information. | 
| + // There is a const version of each that returns a reference, | 
| + // and a non-const version that returns a pointer, in order | 
| + // to allow modification of the parameters. | 
| + 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.
 
 | 
| + 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.
 
 | 
| + return &codecSpecific_.VP8; | 
| + } | 
| + const VideoCodecVP8& VP8() const { | 
| + RTC_CHECK(codecType == kVideoCodecVP8); | 
| + return codecSpecific_.VP8; | 
| + } | 
| + VideoCodecVP9* VP9() { | 
| + RTC_DCHECK(codecType == kVideoCodecVP9); | 
| + return &codecSpecific_.VP9; | 
| + } | 
| + const VideoCodecVP9& VP9() const { | 
| + RTC_DCHECK(codecType == kVideoCodecVP9); | 
| + return codecSpecific_.VP9; | 
| + } | 
| + VideoCodecH264* H264() { | 
| + RTC_DCHECK(codecType == kVideoCodecH264); | 
| + return &codecSpecific_.H264; | 
| + } | 
| + const VideoCodecH264& H264() const { | 
| + RTC_DCHECK(codecType == kVideoCodecH264); | 
| + return codecSpecific_.H264; | 
| + } | 
| + | 
| + private: | 
| + // 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
 
 | 
| + // This will allow removing the VideoCodec* types from this file. | 
| + 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.
 
 | 
| }; | 
| // Bandwidth over-use detector options. These are used to drive |