Bug 1403204 - Code that configures telephone-event should not assume that it is always last in the codec array; r=bwc
authorDan Minor <dminor@mozilla.com>
Tue, 26 Sep 2017 15:29:22 -0400
changeset 383261 3f05e4bf0fac5e97e76d8e15fb7c67b06e83d92b
parent 383260 e81bc5a17a4f723b597085c72fb43d32595985ef
child 383262 69dfc35d912dfaa096f9e9d66cda13ef60babe38
push id95539
push userkwierso@gmail.com
push dateThu, 28 Sep 2017 00:01:12 +0000
treeherdermozilla-inbound@72de90e66155 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1403204
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1403204 - Code that configures telephone-event should not assume that it is always last in the codec array; r=bwc Instead, iterate over the values. MozReview-Commit-ID: KtPmA9fnyIU
media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -727,22 +727,23 @@ MediaPipelineFactory::GetOrCreateAudioCo
       if (!conduit->SetLocalSSRCs(ssrcs)) {
         MOZ_MTLOG(ML_ERROR, "SetLocalSSRCs failed");
         return NS_ERROR_FAILURE;
       }
     }
 
     conduit->SetLocalCNAME(aTrack.GetCNAME().c_str());
 
-    if (configs.values.size() > 1
-        && configs.values.back()->mName == "telephone-event") {
-      // we have a telephone event codec, so we need to make sure
-      // the dynamic pt is set properly
-      conduit->SetDtmfPayloadType(configs.values.back()->mType,
-                                  configs.values.back()->mFreq);
+    for (auto value: configs.values) {
+      if (value->mName == "telephone-event") {
+        // we have a telephone event codec, so we need to make sure
+        // the dynamic pt is set properly
+        conduit->SetDtmfPayloadType(value->mType, value->mFreq);
+        break;
+      }
     }
 
     auto error = conduit->ConfigureSendMediaCodec(configs.values[0]);
     if (error) {
       MOZ_MTLOG(ML_ERROR, "ConfigureSendMediaCodec failed: " << error);
       return NS_ERROR_FAILURE;
     }