Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: chrome/test/data/webrtc/peerconnection.js

Issue 2190533002: Adds a WebRTC browser_test with opus dtx enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webrtc/peerconnection.js
diff --git a/chrome/test/data/webrtc/peerconnection.js b/chrome/test/data/webrtc/peerconnection.js
index 639e0f41a8ff34624bc5be8ea6fed1aeb640b757..ff5980c1a43741ab78ad61cc9afd08c9f2ce3f40 100644
--- a/chrome/test/data/webrtc/peerconnection.js
+++ b/chrome/test/data/webrtc/peerconnection.js
@@ -77,8 +77,12 @@ function preparePeerConnectionWithCertificate(certificate) {
* the default video codec, e.g. the first one in the list on the 'm=video'
* SDP offer line. |videoCodec| is the case-sensitive codec name, e.g.
* 'VP8' or 'H264'.
+ * @param {boolean} enableOpusDtx If true, enable Opus Dtx, e.g. append
+ * 'usedtx=1' to the appropriate 'a=fmtp' line.
*/
-function createLocalOffer(constraints, videoCodec = null) {
+function createLocalOffer(constraints,
+ videoCodec = null,
+ enableOpusDtx = false) {
peerConnection_().createOffer(
function(localOffer) {
success('createOffer');
@@ -86,6 +90,8 @@ function createLocalOffer(constraints, videoCodec = null) {
setLocalDescription(peerConnection, localOffer);
if (videoCodec !== null)
localOffer.sdp = setSdpDefaultVideoCodec(localOffer.sdp, videoCodec);
+ if (enableOpusDtx)
+ localOffer.sdp = setOpusDtxEnabled(localOffer.sdp);
returnToTest('ok-' + JSON.stringify(localOffer));
},
@@ -101,8 +107,12 @@ function createLocalOffer(constraints, videoCodec = null) {
* @param {!string} sessionDescJson A JSON-encoded session description of type
* 'offer'.
* @param {!Object} constraints Any createAnswer constraints.
+ * @param {boolean} enableOpusDtx If true, enable Opus Dtx, e.g. append
+ * 'usedtx=1' to the appropriate 'a=fmtp' line.
*/
-function receiveOfferFromPeer(sessionDescJson, constraints) {
+function receiveOfferFromPeer(sessionDescJson,
+ constraints,
+ enableOpusDtx = false) {
offer = parseJson_(sessionDescJson);
if (!offer.type)
failTest('Got invalid session description from peer: ' + sessionDescJson);
@@ -119,6 +129,8 @@ function receiveOfferFromPeer(sessionDescJson, constraints) {
function(answer) {
success('createAnswer');
setLocalDescription(peerConnection, answer);
+ if (enableOpusDtx)
+ answer.sdp = setOpusDtxEnabled(answer.sdp);
returnToTest('ok-' + JSON.stringify(answer));
},
function(error) { failure('createAnswer', error); },
@@ -154,6 +166,22 @@ function verifyDefaultVideoCodec(sessionDescJson, expectedVideoCodec) {
}
/**
+ * Verifies that Opus Dtx is enabled, e.g. 'usedtx=1' can be found in the
+ * appropriate 'a=fmtp' line. If this is not the case, |failure| occurs.
+ *
+ * @param {!string} sessionDescJson A JSON-encoded session description.
+ */
+function verifyOpusDtxEnabled(sessionDescJson) {
+ var sessionDesc = parseJson_(sessionDescJson);
+ if (!sessionDesc.type) {
+ failure('verifyOpusDtxEnabled',
+ 'Invalid session description: ' + sessionDescJson);
+ }
+ checkOpusDtxEnabled(sessionDesc.sdp);
+ returnToTest('ok-verified');
+}
+
+/**
* Asks this page to accept an answer generated by the peer in response to a
* previous offer by this page
*
« chrome/browser/media/webrtc_perf_browsertest.cc ('K') | « chrome/test/data/webrtc/munge_sdp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698