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
--- 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;
}