Removing `preference` field from `cricket::Codec`.

This field only existed as an implementation detail for getting the
codecs sorted, so it doesn't need to be in the public interface.
It cluttered the code and undesirably affected codec comparisons,
causing the video encoder to be reconfigured if a codec's preference
changed but nothing else did.

BUG=webrtc:5690

Review URL: https://codereview.webrtc.org/1845673002

Cr-Commit-Position: refs/heads/master@{#12349}
diff --git a/webrtc/api/webrtcsdp_unittest.cc b/webrtc/api/webrtcsdp_unittest.cc
index 3734ac5..2b63c79 100644
--- a/webrtc/api/webrtcsdp_unittest.cc
+++ b/webrtc/api/webrtcsdp_unittest.cc
@@ -1030,10 +1030,10 @@
         "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32",
         "dummy_session_params"));
     audio->set_protocol(cricket::kMediaProtocolSavpf);
-    AudioCodec opus(111, "opus", 48000, 0, 2, 3);
+    AudioCodec opus(111, "opus", 48000, 0, 2);
     audio->AddCodec(opus);
-    audio->AddCodec(AudioCodec(103, "ISAC", 16000, 32000, 1, 2));
-    audio->AddCodec(AudioCodec(104, "ISAC", 32000, 56000, 1, 1));
+    audio->AddCodec(AudioCodec(103, "ISAC", 16000, 32000, 1));
+    audio->AddCodec(AudioCodec(104, "ISAC", 32000, 56000, 1));
     return audio;
   }
 
@@ -1049,8 +1049,7 @@
         VideoCodec(120, JsepSessionDescription::kDefaultVideoCodecName,
                    JsepSessionDescription::kMaxVideoCodecWidth,
                    JsepSessionDescription::kMaxVideoCodecHeight,
-                   JsepSessionDescription::kDefaultVideoCodecFramerate,
-                   JsepSessionDescription::kDefaultVideoCodecPreference));
+                   JsepSessionDescription::kDefaultVideoCodecFramerate));
     return video;
   }
 
@@ -1400,7 +1399,7 @@
     data_desc_ = data.get();
     data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp);
     DataCodec codec(cricket::kGoogleSctpDataCodecId,
-                    cricket::kGoogleSctpDataCodecName, 0);
+                    cricket::kGoogleSctpDataCodecName);
     codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort);
     data_desc_->AddCodec(codec);
     desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release());
@@ -1413,7 +1412,7 @@
         new DataContentDescription());
     data_desc_ = data.get();
 
-    data_desc_->AddCodec(DataCodec(101, "google-data", 1));
+    data_desc_->AddCodec(DataCodec(101, "google-data"));
     StreamParams data_stream;
     data_stream.id = kDataChannelMsid;
     data_stream.cname = kDataChannelCname;
@@ -1995,8 +1994,8 @@
       jsep_desc.description()->GetContentDescriptionByName(kDataContentName));
 
   const int kNewPort = 1234;
-  cricket::DataCodec codec(
-        cricket::kGoogleSctpDataCodecId, cricket::kGoogleSctpDataCodecName, 0);
+  cricket::DataCodec codec(cricket::kGoogleSctpDataCodecId,
+                           cricket::kGoogleSctpDataCodecName);
   codec.SetParam(cricket::kCodecParamPort, kNewPort);
   dcdesc->AddOrReplaceCodec(codec);
 
@@ -2177,10 +2176,11 @@
     static_cast<AudioContentDescription*>(
         jdesc.description()->GetContentDescriptionByName(cricket::CN_AUDIO));
   AudioCodecs ref_codecs;
-  // The codecs in the AudioContentDescription will be sorted by preference.
-  ref_codecs.push_back(AudioCodec(0, "PCMU", 8000, 0, 1, 3));
-  ref_codecs.push_back(AudioCodec(18, "G729", 16000, 0, 1, 2));
-  ref_codecs.push_back(AudioCodec(103, "ISAC", 16000, 32000, 1, 1));
+  // The codecs in the AudioContentDescription should be in the same order as
+  // the payload types (<fmt>s) on the m= line.
+  ref_codecs.push_back(AudioCodec(0, "PCMU", 8000, 0, 1));
+  ref_codecs.push_back(AudioCodec(18, "G729", 16000, 0, 1));
+  ref_codecs.push_back(AudioCodec(103, "ISAC", 16000, 32000, 1));
   EXPECT_EQ(ref_codecs, audio->codecs());
 }