New equality operators, for structs related to webrtc::VideoCodec.

Added for the structs VideoCodecVP8, VideoCodecVP9, VideoCodecH264,
and SpatialLayer.

New operators are used to replace memcmp in VCMEncoderDataBase. Using
memcmp to compare structs is generally unreliable, since the struct
may contain random padding bytes due to alignment requirements
(affects at least VideoCodecH264). And in the case of VideoCodecVP8,
we need to exclude the tl_factory pointers from the comparison.

Bug: webrtc:8830
Change-Id: I40432ea7834e288f8c89ce0a28a630ae1800dff8
Reviewed-on: https://webrtc-review.googlesource.com/62761
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22500}
diff --git a/common_types.h b/common_types.h
index ee4ddf7..482cb04 100644
--- a/common_types.h
+++ b/common_types.h
@@ -422,6 +422,10 @@
 class TemporalLayersFactory;
 // VP8 specific
 struct VideoCodecVP8 {
+  bool operator==(const VideoCodecVP8& other) const;
+  bool operator!=(const VideoCodecVP8& other) const {
+    return !(*this == other);
+  }
   VideoCodecComplexity complexity;
   VP8ResilienceMode resilience;
   unsigned char numberOfTemporalLayers;
@@ -434,6 +438,10 @@
 
 // VP9 specific.
 struct VideoCodecVP9 {
+  bool operator==(const VideoCodecVP9& other) const;
+  bool operator!=(const VideoCodecVP9& other) const {
+    return !(*this == other);
+  }
   VideoCodecComplexity complexity;
   bool resilienceOn;
   unsigned char numberOfTemporalLayers;
@@ -461,6 +469,10 @@
 
 // H264 specific.
 struct VideoCodecH264 {
+  bool operator==(const VideoCodecH264& other) const;
+  bool operator!=(const VideoCodecH264& other) const {
+    return !(*this == other);
+  }
   bool frameDroppingOn;
   int keyFrameInterval;
   // These are NULL/0 if not externally negotiated.
@@ -496,6 +508,9 @@
 };
 
 struct SpatialLayer {
+  bool operator==(const SpatialLayer& other) const;
+  bool operator!=(const SpatialLayer& other) const { return !(*this == other); }
+
   unsigned short width;
   unsigned short height;
   unsigned char numberOfTemporalLayers;