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

Unified Diff: chrome/test/data/webrtc/munge_sdp.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: Addressed review comments. 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
« no previous file with comments | « chrome/browser/media/webrtc_video_quality_browsertest.cc ('k') | chrome/test/data/webrtc/peerconnection.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webrtc/munge_sdp.js
diff --git a/chrome/test/data/webrtc/munge_sdp.js b/chrome/test/data/webrtc/munge_sdp.js
index 9a8a37e6d78a754b5c195dc119360c131b5711e1..1c61d0ea72f8f4b0144e41da80bcbd97055c9612 100644
--- a/chrome/test/data/webrtc/munge_sdp.js
+++ b/chrome/test/data/webrtc/munge_sdp.js
@@ -19,6 +19,68 @@ function setSdpDefaultVideoCodec(sdp, codec) {
}
/**
+ * Returns a modified version of |sdp| where the opus DTX flag has been
+ * enabled.
+ */
+function setOpusDtxEnabled(sdp) {
+ var sdpLines = splitSdpLines(sdp);
+
+ // Get default audio codec
+ var defaultCodec = getSdpDefaultAudioCodec(sdp);
+ if (defaultCodec !== 'opus') {
+ failure('setOpusDtxEnabled',
+ 'Default audio codec is not set to \'opus\'.');
+ }
+
+ // Find codec ID for Opus, e.g. 111 if 'a=rtpmap:111 opus/48000/2'.
+ var codecId = findRtpmapId(sdpLines, 'opus');
+ if (codecId === null) {
+ failure('setOpusDtxEnabled', 'Unknown ID for |codec| = \'opus\'.');
+ }
+
+ // Find 'a=fmtp:111' line, where 111 is the codecId
minyue 2016/07/28 12:53:29 add findFmtpLine as a helper function
Ivo-OOO until feb 6 2016/07/28 14:00:07 Done.
+ var fmtLineNo = findLine(sdpLines, 'a=fmtp:' + codecId);
+ if (fmtLineNo === null) {
+ failure('setOpusDtxEnabled',
minyue 2016/07/28 12:53:29 in this case, we may add "a=fmtp:" + |codecId| lin
Ivo-OOO until feb 6 2016/07/28 14:00:07 Done.
+ '\'a=fmtp:' + codecId + '\' line missing from |sdp|.');
+ }
+
+ // Modify the line to enable Opus Dtx.
+ sdpLines[fmtLineNo] += ';usedtx=1'
+ return mergeSdpLines(sdpLines);
+}
+
+/**
+ * Check if the opus Dtx flag has been set in |sdp|.
+ */
+function checkOpusDtxEnabled(sdp) {
phoglund_chromium 2016/07/28 12:46:38 Ok, then you don't need this anymore right?
Ivo-OOO until feb 6 2016/07/28 14:00:07 Good point, removed this.
+ var defaultAudioCodec = getSdpDefaultAudioCodec(sdp);
+ if (defaultAudioCodec !== 'opus') {
+ failure('verifyOpusDtxEnabled',
+ 'Default audio codec is not set to opus.');
+ }
+ var sdpLines = splitSdpLines(sdp);
+ // Find codec ID for Opus, e.g. 111 if 'a=rtpmap:111 opus/48000/2'.
+ var codecId = findRtpmapId(sdpLines, 'opus');
+ if (codecId === null) {
+ failure('verifyOpusDtxEnabled', 'Unknown ID for |codec| = \'opus\'.');
+ }
+
+ // Find 'a=fmtp:111' line, where 111 is the codecId
+ var fmtLineNo = findLine(sdpLines, 'a=fmtp:' + codecId);
+ if (fmtLineNo === null) {
+ failure('verifyOpusDtxEnabled',
+ '\'a=fmtp:' + codecId + '\' line missing from |sdp|.');
+ }
+
+ // Check that 'usedtx=1' appears on the line.
+ if (sdpLines[fmtLineNo].indexOf('usedtx=1') === -1) {
+ failure('verifyOpusDtxEnabled',
+ '\'usedtx=1\' is missing from \'a=fmtp:' + codecId + '\' line.');
+ }
+}
+
+/**
* Returns a modified version of |sdp| where the |codec| has been promoted to be
* the default codec, i.e. the codec whose ID is first in the list of codecs on
* the 'm=|type|' line, where |type| is 'audio' or 'video'.
« no previous file with comments | « chrome/browser/media/webrtc_video_quality_browsertest.cc ('k') | chrome/test/data/webrtc/peerconnection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698