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

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

Issue 2652373002: EME: Fail requestMediaKeySystemAccess if no capabilities specified (Closed)
Patch Set: more changes 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 == 'video/webm; codecs="vp8"' || 117 if (player.testConfig.mediaType) {
118 player.testConfig.mediaType == 'video/webm; codecs="vp9"' || 118 if (player.testConfig.mediaType.substring(0, 5) == 'video') {
119 player.testConfig.mediaType == 'video/mp4; codecs="avc1.4D000C"') { 119 config.videoCapabilities = [{contentType: player.testConfig.mediaType}];
120 // Video only. 120 } else if (player.testConfig.mediaType.substring(0, 5) == 'audio') {
121 config.videoCapabilities = [{contentType: player.testConfig.mediaType}]; 121 config.audioCapabilities = [{contentType: player.testConfig.mediaType}];
122 } else if ( 122 }
123 player.testConfig.mediaType == 'audio/webm; codecs="vorbis"' || 123 // Handle special cases where both audio and video are needed.
124 player.testConfig.mediaType == 'audio/webm; codecs="opus"' || 124 if (player.testConfig.mediaType == 'video/webm; codecs="vorbis, vp8"') {
125 player.testConfig.mediaType == 'audio/mp4; codecs="mp4a.40.2"') { 125 config.audioCapabilities = [{contentType: 'audio/webm; codecs="vorbis"'}];
126 // Audio only. 126 config.videoCapabilities = [{contentType: 'video/webm; codecs="vp8"'}];
127 config.audioCapabilities = [{contentType: player.testConfig.mediaType}]; 127 } else if (
128 } else if ( 128 player.testConfig.mediaType == 'video/webm; codecs="opus, vp9"') {
129 player.testConfig.mediaType == 'video/webm; codecs="vorbis, vp8"') { 129 config.audioCapabilities = [{contentType: 'audio/webm; codecs="opus"'}];
130 // Both audio and video codecs specified. 130 config.videoCapabilities = [{contentType: 'video/webm; codecs="vp9"'}];
131 config.audioCapabilities = [{contentType: 'audio/webm; codecs="vorbis"'}]; 131 }
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"'}];
137 } else { 132 } else {
138 // Some tests (e.g. mse_different_containers.html) specify audio and 133 // Some tests (e.g. mse_different_containers.html) specify audio and
139 // video codecs seperately. 134 // video codecs seperately.
140 if (player.testConfig.videoFormat == 'ENCRYPTED_MP4' || 135 if (player.testConfig.videoFormat == 'ENCRYPTED_MP4' ||
141 player.testConfig.videoFormat == 'CLEAR_MP4') { 136 player.testConfig.videoFormat == 'CLEAR_MP4') {
142 config.videoCapabilities = 137 config.videoCapabilities =
143 [{contentType: 'video/mp4; codecs="avc1.4D000C"'}]; 138 [{contentType: 'video/mp4; codecs="avc1.4D000C"'}];
144 } else if ( 139 } else if (
145 player.testConfig.videoFormat == 'ENCRYPTED_WEBM' || 140 player.testConfig.videoFormat == 'ENCRYPTED_WEBM' ||
146 player.testConfig.videoFormat == 'CLEAR_WEBM') { 141 player.testConfig.videoFormat == 'CLEAR_WEBM') {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 case VERIFY_HOST_FILES_TEST_KEYSYSTEM: 211 case VERIFY_HOST_FILES_TEST_KEYSYSTEM:
217 return UnitTestPlayer; 212 return UnitTestPlayer;
218 default: 213 default:
219 Utils.timeLog(keySystem + ' is not a known key system'); 214 Utils.timeLog(keySystem + ' is not a known key system');
220 return ClearKeyPlayer; 215 return ClearKeyPlayer;
221 } 216 }
222 } 217 }
223 var Player = getPlayerType(testConfig.keySystem); 218 var Player = getPlayerType(testConfig.keySystem);
224 return new Player(video, testConfig); 219 return new Player(video, testConfig);
225 }; 220 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698