514e9c6e by Rajko Stojadinovic Committed by David LaPalomento

Have key.iv be undefined if IV not present

1 parent 09c57621
......@@ -440,9 +440,12 @@
// setup an encryption key for upcoming segments
key = {
method: entry.attributes.METHOD || 'AES-128',
uri: entry.attributes.URI,
iv: entry.attributes.IV || null
uri: entry.attributes.URI
};
if (entry.attributes.IV !== undefined) {
key.iv = entry.attributes.IV
}
},
'media-sequence': function() {
if (!isFinite(entry.number)) {
......
......@@ -704,13 +704,10 @@ videojs.Hls.prototype.drainBuffer = function(event) {
} else {
// if the media sequence is greater than 2^32, the IV will be incorrect
// assuming 10s segments, that would be about 1300 years
var theIv = segment.key.iv;
if (theIv === null) {
theIv = new Uint32Array([0, 0, 0, mediaIndex + playlist.mediaSequence]);
}
var segIv = segment.key.iv || new Uint32Array([0, 0, 0, mediaIndex + playlist.mediaSequence]);
bytes = videojs.Hls.decrypt(bytes,
segment.key.bytes,
theIv);
segIv);
}
}
......
......@@ -6,8 +6,7 @@
"duration": 2.833,
"key": {
"method": "AES-128",
"uri": "https://priv.example.com/key.php?r=52",
"iv": null
"uri": "https://priv.example.com/key.php?r=52"
},
"uri": "http://media.example.com/fileSequence52-A.ts"
},
......@@ -15,8 +14,7 @@
"duration": 15,
"key": {
"method": "AES-128",
"uri": "https://priv.example.com/key.php?r=52",
"iv": null
"uri": "https://priv.example.com/key.php?r=52"
},
"uri": "http://media.example.com/fileSequence52-B.ts"
},
......@@ -24,8 +22,7 @@
"duration": 13.333,
"key": {
"method": "AES-128",
"uri": "https://priv.example.com/key.php?r=52",
"iv": null
"uri": "https://priv.example.com/key.php?r=52"
},
"uri": "http://media.example.com/fileSequence52-C.ts"
},
......@@ -33,8 +30,7 @@
"duration": 15,
"key": {
"method": "AES-128",
"uri": "https://priv.example.com/key.php?r=53",
"iv": null
"uri": "https://priv.example.com/key.php?r=53"
},
"uri": "http://media.example.com/fileSequence53-A.ts"
},
......