Chromium Code Reviews| Index: chrome/test/data/media/eme_player_js/utils.js |
| diff --git a/chrome/test/data/media/eme_player_js/utils.js b/chrome/test/data/media/eme_player_js/utils.js |
| index e664593e8e56c6536a090817d4fc6dccc41ccb01..3c5e9525c2ab9023985a846bbc71f4324f572db2 100644 |
| --- a/chrome/test/data/media/eme_player_js/utils.js |
| +++ b/chrome/test/data/media/eme_player_js/utils.js |
| @@ -30,11 +30,16 @@ Utils.convertToArray = function(input) { |
| }; |
| Utils.convertToUint8Array = function(msg) { |
| - var ans = new Uint8Array(msg.length); |
| - for (var i = 0; i < msg.length; i++) { |
| - ans[i] = msg.charCodeAt(i); |
| + if (typeof msg == 'string') { |
| + var ans = new Uint8Array(msg.length); |
| + for (var i = 0; i < msg.length; i++) { |
| + ans[i] = msg.charCodeAt(i); |
| + } |
| + return ans; |
| } |
| - return ans; |
| + // Assume it is ArrayBuffer or ArrayBufferView. If it already a Uint8Array, |
| + // this will just make a copy. |
|
ddorwin
2014/07/20 22:35:05
... of the view.
right?
Change the last sentence
jrummell
2014/07/23 22:30:05
Done.
|
| + return new Uint8Array(msg); |
| }; |
| Utils.createJWKData = function(keyId, key) { |
| @@ -150,7 +155,7 @@ Utils.getHexString = function(uintArray) { |
| }; |
| Utils.getInitDataFromMessage = function(message, mediaType) { |
| - var initData = message.message; |
| + var initData = Utils.convertToUint8Array(message.message); |
|
ddorwin
2014/07/20 22:35:05
This will probably need to change when we update C
jrummell
2014/07/23 22:30:06
Acknowledged.
|
| if (mediaType.indexOf('mp4') != -1) { |
| // Temporary hack for Clear Key in v0.1. |
| // If content uses mp4, then message.message is PSSH data. Instead of |