Bug 1221837 - Accept hard coded codec numbers without rtpmaps. r=bwc

--HG--
rename : dom/media/tests/mochitest/test_peerConnection_basicAudio.html => dom/media/tests/mochitest/test_peerConnection_basicAudioPcmaPcmuOnly.html
extra : rebase_source : ca8ab16272e2b3fc58019518d3d31e43430e7283
This commit is contained in:
Nils Ohlmeier [:drno] 2015-11-15 23:26:46 -08:00
parent 32ccc4c2b0
commit 1d8c0abcc0
5 changed files with 58 additions and 6 deletions

View File

@ -72,6 +72,8 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing
skip-if = toolkit == 'gonk' # B2G emulator is too slow to handle a two-way audio call reliably
[test_peerConnection_basicAudioRequireEOC.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
[test_peerConnection_basicAudioPcmaPcmuOnly.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
[test_peerConnection_basicAudioVideo.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_basicAudioVideoCombined.html]

View File

@ -62,6 +62,7 @@ function PeerConnectionTest(options) {
options.h264 = "h264" in options ? options.h264 : false;
options.bundle = "bundle" in options ? options.bundle : true;
options.rtcpmux = "rtcpmux" in options ? options.rtcpmux : true;
options.opus = "opus" in options ? options.opus : true;
if (typeof turnServers !== "undefined") {
if ((!options.turn_disabled_local) && (turnServers.local)) {

View File

@ -45,6 +45,14 @@ removeBundle: function(sdp) {
return sdp.replace(/a=group:BUNDLE .*\r\n/g, "");
},
reduceAudioMLineToPcmuPcma: function(sdp) {
return sdp.replace(/m=audio .*\r\n/g, "m=audio 9 UDP/TLS/RTP/SAVPF 0 8\r\n");
},
removeAllRtpMaps: function(sdp) {
return sdp.replace(/a=rtpmap:.*\r\n/g, "");
},
verifySdp: function(desc, expectedType, offerConstraintsList, offerOptions,
testOptions) {
info("Examining this SessionDescription: " + JSON.stringify(desc));
@ -76,7 +84,7 @@ verifySdp: function(desc, expectedType, offerConstraintsList, offerOptions,
ok(!desc.sdp.includes("m=audio"), "audio m-line is absent from SDP");
} else {
ok(desc.sdp.includes("m=audio"), "audio m-line is present in SDP");
ok(desc.sdp.includes("a=rtpmap:109 opus/48000/2"), "OPUS codec is present in SDP");
is(testOptions.opus, desc.sdp.includes("a=rtpmap:109 opus/48000/2"), "OPUS codec is present in SDP");
//TODO: ideally the rtcp-mux should be for the m=audio, and not just
// anywhere in the SDP (JS SDP parser bug 1045429)
is(testOptions.rtcpmux, desc.sdp.includes("a=rtcp-mux"), "RTCP Mux is offered in SDP");

View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796892",
title: "Only offer PCMA and PMCU in mline (no rtpmaps)"
});
var test;
runNetworkTest(function (options) {
options = options || { };
options.opus = false;
test = new PeerConnectionTest(options);
test.chain.insertBefore("PC_REMOTE_GET_OFFER", [
function PC_LOCAL_REDUCE_MLINE_REMOVE_RTPMAPS(test) {
test.originalOffer.sdp =
sdputils.reduceAudioMLineToPcmuPcma(test.originalOffer.sdp);
test.originalOffer.sdp =
sdputils.removeAllRtpMaps(test.originalOffer.sdp);
info("SDP without Rtpmaps: " + JSON.stringify(test.originalOffer));
}
]);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
</script>
</pre>
</body>
</html>

View File

@ -56,11 +56,18 @@ class JsepCodecDescription {
const SdpRtpmapAttributeList::Rtpmap* entry(remoteMsection.FindRtpmap(fmt));
if (entry
&& !nsCRT::strcasecmp(mName.c_str(), entry->name.c_str())
&& (mClock == entry->clock)
&& (mChannels == entry->channels)) {
return ParametersMatch(fmt, remoteMsection);
if (entry) {
if (!nsCRT::strcasecmp(mName.c_str(), entry->name.c_str())
&& (mClock == entry->clock)
&& (mChannels == entry->channels)) {
return ParametersMatch(fmt, remoteMsection);
}
} else if (fmt.compare("9") && mName == "G722") {
return true;
} else if (fmt.compare("0") && mName == "PCMU") {
return true;
} else if (fmt.compare("8") && mName == "PCMA") {
return true;
}
return false;
}