Fix some sign-compare warnings in webrtc/api.

The disabling of the warnings doesn't seem to work when Chromium
is using our targets (https://codereview.chromium.org/2022833002)
so better fix them.

BUG=webrtc:4256,webrtc:3307
NOTRY=True

Review-Url: https://codereview.webrtc.org/2074423002
Cr-Commit-Position: refs/heads/master@{#13217}
diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn
index cb3066e..442ecbf 100644
--- a/webrtc/api/BUILD.gn
+++ b/webrtc/api/BUILD.gn
@@ -19,11 +19,8 @@
   # GN orders flags on a target before flags from configs. The default config
   # adds these flags so to cancel them out they need to come from a config and
   # cannot be on the target directly.
-  if (!is_win) {
-    cflags = [ "-Wno-sign-compare" ]
-    if (!is_clang) {
-      cflags += [ "-Wno-maybe-uninitialized" ]  # Only exists for GCC.
-    }
+  if (!is_win && !is_clang) {
+    cflags = [ "-Wno-maybe-uninitialized" ]  # Only exists for GCC.
   }
 }
 
@@ -110,10 +107,6 @@
     configs -= [ "//build/config/clang:find_bad_constructs" ]
   }
 
-  if (is_win) {
-    cflags += [ "/wd4389" ]  # signed/unsigned mismatch.
-  }
-
   deps = [
     "../call",
     "../media",
diff --git a/webrtc/api/api.gyp b/webrtc/api/api.gyp
index 8525eb0..a3113ab 100644
--- a/webrtc/api/api.gyp
+++ b/webrtc/api/api.gyp
@@ -169,11 +169,6 @@
         'webrtcsessiondescriptionfactory.cc',
         'webrtcsessiondescriptionfactory.h',
       ],
-      # TODO(kjellander): Make the code compile without disabling these flags.
-      # See https://bugs.chromium.org/p/webrtc/issues/detail?id=3307
-      'cflags': [
-        '-Wno-sign-compare',
-      ],
       'conditions': [
         ['clang==1', {
           'cflags!': [
@@ -187,23 +182,6 @@
             '-Wno-maybe-uninitialized',  # Only exists for GCC.
           ],
         }],
-        ['OS=="win"', {
-          # Disable warning for signed/unsigned mismatch.
-          'msvs_settings': {
-            'VCCLCompilerTool': {
-              'AdditionalOptions!': ['/we4389'],
-            },
-          },
-        }],
-        ['OS=="win" and clang==1', {
-          'msvs_settings': {
-            'VCCLCompilerTool': {
-              'AdditionalOptions': [
-                '-Wno-sign-compare',
-              ],
-            },
-          },
-        }],
         ['use_quic==1', {
           'dependencies': [
             '<(DEPTH)/third_party/libquic/libquic.gyp:libquic',
diff --git a/webrtc/api/datachannel.cc b/webrtc/api/datachannel.cc
index 5a18e6f..3435fa5 100644
--- a/webrtc/api/datachannel.cc
+++ b/webrtc/api/datachannel.cc
@@ -384,7 +384,8 @@
 }
 
 void DataChannel::OnStreamClosedRemotely(uint32_t sid) {
-  if (data_channel_type_ == cricket::DCT_SCTP && sid == config_.id) {
+  if (data_channel_type_ == cricket::DCT_SCTP &&
+      sid == static_cast<uint32_t>(config_.id)) {
     Close();
   }
 }
diff --git a/webrtc/api/videocapturertracksource.cc b/webrtc/api/videocapturertracksource.cc
index 2321d83..2bef143 100644
--- a/webrtc/api/videocapturertracksource.cc
+++ b/webrtc/api/videocapturertracksource.cc
@@ -314,7 +314,7 @@
     } else {
       // The VideoCapturer implementation doesn't support capability
       // enumeration. We need to guess what the camera supports.
-      for (int i = 0; i < arraysize(kVideoFormats); ++i) {
+      for (uint32_t i = 0; i < arraysize(kVideoFormats); ++i) {
         formats.push_back(cricket::VideoFormat(kVideoFormats[i]));
       }
     }
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index b2e75a2..0b8d6f6 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -2190,7 +2190,8 @@
     int payload_type = *it;
     if (!media_desc->HasCodec(payload_type) &&
         payload_type >= 0 &&
-        payload_type < arraysize(kStaticPayloadAudioCodecs)) {
+        static_cast<uint32_t>(payload_type) <
+            arraysize(kStaticPayloadAudioCodecs)) {
       std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name;
       int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate;
       size_t channels = kStaticPayloadAudioCodecs[payload_type].channels;