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

Side by Side Diff: media/test/data/eme_player_js/player_utils.js

Issue 2707393002: Revert "EME: Fail requestMediaKeySystemAccess if no capabilities specified"
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The PlayerUtils provides utility functions to binding common media events 5 // The PlayerUtils provides utility functions to binding common media events
6 // to specific player functions. It also provides functions to load media source 6 // to specific player functions. It also provides functions to load media source
7 // base on test configurations. 7 // base on test configurations.
8 var PlayerUtils = new function() { 8 var PlayerUtils = new function() {
9 } 9 }
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 audioCapabilities: [], 107 audioCapabilities: [],
108 videoCapabilities: [], 108 videoCapabilities: [],
109 persistentState: 'optional', 109 persistentState: 'optional',
110 sessionTypes: ['temporary'], 110 sessionTypes: ['temporary'],
111 }; 111 };
112 112
113 // requestMediaKeySystemAccess() requires at least one of 'audioCapabilities' 113 // requestMediaKeySystemAccess() requires at least one of 'audioCapabilities'
114 // or 'videoCapabilities' to be specified. It also requires only codecs 114 // or 'videoCapabilities' to be specified. It also requires only codecs
115 // specific to the capability, so unlike MSE cannot have both audio and 115 // specific to the capability, so unlike MSE cannot have both audio and
116 // video codecs in the contentType. 116 // video codecs in the contentType.
117 if (player.testConfig.mediaType) { 117 if (player.testConfig.mediaType == 'video/webm; codecs="vp8"' ||
118 if (player.testConfig.mediaType.substring(0, 5) == 'video') { 118 player.testConfig.mediaType == 'video/webm; codecs="vp9"' ||
119 config.videoCapabilities = [{contentType: player.testConfig.mediaType}]; 119 player.testConfig.mediaType == 'video/mp4; codecs="avc1.4D000C"') {
120 } else if (player.testConfig.mediaType.substring(0, 5) == 'audio') { 120 // Video only.
121 config.audioCapabilities = [{contentType: player.testConfig.mediaType}]; 121 config.videoCapabilities = [{contentType: player.testConfig.mediaType}];
122 } 122 } else if (
123 // Handle special cases where both audio and video are needed. 123 player.testConfig.mediaType == 'audio/webm; codecs="vorbis"' ||
124 if (player.testConfig.mediaType == 'video/webm; codecs="vorbis, vp8"') { 124 player.testConfig.mediaType == 'audio/webm; codecs="opus"' ||
125 config.audioCapabilities = [{contentType: 'audio/webm; codecs="vorbis"'}]; 125 player.testConfig.mediaType == 'audio/mp4; codecs="mp4a.40.2"') {
126 config.videoCapabilities = [{contentType: 'video/webm; codecs="vp8"'}]; 126 // Audio only.
127 } else if ( 127 config.audioCapabilities = [{contentType: player.testConfig.mediaType}];
128 player.testConfig.mediaType == 'video/webm; codecs="opus, vp9"') { 128 } else if (
129 config.audioCapabilities = [{contentType: 'audio/webm; codecs="opus"'}]; 129 player.testConfig.mediaType == 'video/webm; codecs="vorbis, vp8"') {
130 config.videoCapabilities = [{contentType: 'video/webm; codecs="vp9"'}]; 130 // Both audio and video codecs specified.
131 } 131 config.audioCapabilities = [{contentType: 'audio/webm; codecs="vorbis"'}];
132 config.videoCapabilities = [{contentType: 'video/webm; codecs="vp8"'}];
133 } else if (player.testConfig.mediaType == 'video/webm; codecs="opus, vp9"') {
134 // Both audio and video codecs specified.
135 config.audioCapabilities = [{contentType: 'audio/webm; codecs="opus"'}];
136 config.videoCapabilities = [{contentType: 'video/webm; codecs="vp9"'}];
132 } else { 137 } else {
133 // Some tests (e.g. mse_different_containers.html) specify audio and 138 // Some tests (e.g. mse_different_containers.html) specify audio and
134 // video codecs seperately. 139 // video codecs seperately.
135 if (player.testConfig.videoFormat == 'ENCRYPTED_MP4' || 140 if (player.testConfig.videoFormat == 'ENCRYPTED_MP4' ||
136 player.testConfig.videoFormat == 'CLEAR_MP4') { 141 player.testConfig.videoFormat == 'CLEAR_MP4') {
137 config.videoCapabilities = 142 config.videoCapabilities =
138 [{contentType: 'video/mp4; codecs="avc1.4D000C"'}]; 143 [{contentType: 'video/mp4; codecs="avc1.4D000C"'}];
139 } else if ( 144 } else if (
140 player.testConfig.videoFormat == 'ENCRYPTED_WEBM' || 145 player.testConfig.videoFormat == 'ENCRYPTED_WEBM' ||
141 player.testConfig.videoFormat == 'CLEAR_WEBM') { 146 player.testConfig.videoFormat == 'CLEAR_WEBM') {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 case VERIFY_HOST_FILES_TEST_KEYSYSTEM: 216 case VERIFY_HOST_FILES_TEST_KEYSYSTEM:
212 return UnitTestPlayer; 217 return UnitTestPlayer;
213 default: 218 default:
214 Utils.timeLog(keySystem + ' is not a known key system'); 219 Utils.timeLog(keySystem + ' is not a known key system');
215 return ClearKeyPlayer; 220 return ClearKeyPlayer;
216 } 221 }
217 } 222 }
218 var Player = getPlayerType(testConfig.keySystem); 223 var Player = getPlayerType(testConfig.keySystem);
219 return new Player(video, testConfig); 224 return new Player(video, testConfig);
220 }; 225 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698