Non-zero audio source buffered length
Previously, audio media segments were accepted without error but SourceBuffered.buffered.length was still zero. After this change, the buffered property seems to be read appropriately and no errors are generated but audio is still not output.
Showing
3 changed files
with
22 additions
and
15 deletions
... | @@ -519,11 +519,15 @@ traf = function(track) { | ... | @@ -519,11 +519,15 @@ traf = function(track) { |
519 | 519 | ||
520 | trackFragmentHeader = box(types.tfhd, new Uint8Array([ | 520 | trackFragmentHeader = box(types.tfhd, new Uint8Array([ |
521 | 0x00, // version 0 | 521 | 0x00, // version 0 |
522 | 0x00, 0x00, 0x00, // flags | 522 | 0x00, 0x00, 0x3a, // flags |
523 | (track.id & 0xFF000000) >> 24, | 523 | (track.id & 0xFF000000) >> 24, |
524 | (track.id & 0xFF0000) >> 16, | 524 | (track.id & 0xFF0000) >> 16, |
525 | (track.id & 0xFF00) >> 8, | 525 | (track.id & 0xFF00) >> 8, |
526 | (track.id & 0xFF) // track_ID | 526 | (track.id & 0xFF), // track_ID |
527 | 0x00, 0x00, 0x00, 0x01, // sample_description_index | ||
528 | 0x00, 0x00, 0x00, 0x00, // default_sample_duration | ||
529 | 0x00, 0x00, 0x00, 0x00, // default_sample_size | ||
530 | 0x00, 0x00, 0x00, 0x00 // default_sample_flags | ||
527 | ])); | 531 | ])); |
528 | 532 | ||
529 | trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([ | 533 | trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([ | ... | ... |
... | @@ -1035,8 +1035,12 @@ Transmuxer = function() { | ... | @@ -1035,8 +1035,12 @@ Transmuxer = function() { |
1035 | this.end = function() { | 1035 | this.end = function() { |
1036 | elementaryStream.end(); | 1036 | elementaryStream.end(); |
1037 | h264Stream.end(); | 1037 | h264Stream.end(); |
1038 | videoSegmentStream.end(); | 1038 | if (videoSegmentStream) { |
1039 | audioSegmentStream.end(); | 1039 | videoSegmentStream.end(); |
1040 | } | ||
1041 | if (audioSegmentStream) { | ||
1042 | audioSegmentStream.end(); | ||
1043 | } | ||
1040 | }; | 1044 | }; |
1041 | }; | 1045 | }; |
1042 | Transmuxer.prototype = new videojs.Hls.Stream(); | 1046 | Transmuxer.prototype = new videojs.Hls.Stream(); | ... | ... |
... | @@ -133,6 +133,8 @@ | ... | @@ -133,6 +133,8 @@ |
133 | vjsParsed, | 133 | vjsParsed, |
134 | workingParsed, | 134 | workingParsed, |
135 | diffParsed, | 135 | diffParsed, |
136 | vjsBytes, | ||
137 | workingBytes, | ||
136 | 138 | ||
137 | vjsBoxes = document.querySelector('.vjs-boxes'), | 139 | vjsBoxes = document.querySelector('.vjs-boxes'), |
138 | workingBoxes = document.querySelector('.working-boxes'), | 140 | workingBoxes = document.querySelector('.working-boxes'), |
... | @@ -175,9 +177,12 @@ | ... | @@ -175,9 +177,12 @@ |
175 | if (workingParsed[0].type === 'moof') { | 177 | if (workingParsed[0].type === 'moof') { |
176 | diff = '<h3>Media Segment Comparision</h3>'; | 178 | diff = '<h3>Media Segment Comparision</h3>'; |
177 | transmuxed = vjsParsed.slice(2); | 179 | transmuxed = vjsParsed.slice(2); |
178 | } else { | 180 | } else if (workingParsed.length === 2) { |
179 | diff = '<h3>Init Segment Comparision</h3>'; | 181 | diff = '<h3>Init Segment Comparision</h3>'; |
180 | transmuxed = vjsParsed.slice(0, 2); | 182 | transmuxed = vjsParsed.slice(0, 2); |
183 | } else { | ||
184 | diff = '<h3>General Comparision</h3>'; | ||
185 | transmuxed = vjsParsed; | ||
181 | } | 186 | } |
182 | diff += '<p>A <del>red background</del> indicates ' + | 187 | diff += '<p>A <del>red background</del> indicates ' + |
183 | 'properties present in the transmuxed file but missing from the ' + | 188 | 'properties present in the transmuxed file but missing from the ' + |
... | @@ -222,7 +227,6 @@ | ... | @@ -222,7 +227,6 @@ |
222 | transmuxer = new videojs.mp2t.Transmuxer(), | 227 | transmuxer = new videojs.mp2t.Transmuxer(), |
223 | events = [], | 228 | events = [], |
224 | bytesLength = 0, | 229 | bytesLength = 0, |
225 | done = false, | ||
226 | bytes, | 230 | bytes, |
227 | i, j, | 231 | i, j, |
228 | hex = ''; | 232 | hex = ''; |
... | @@ -242,6 +246,7 @@ | ... | @@ -242,6 +246,7 @@ |
242 | i += events[j].byteLength; | 246 | i += events[j].byteLength; |
243 | } | 247 | } |
244 | 248 | ||
249 | vjsBytes = bytes; | ||
245 | vjsParsed = videojs.inspectMp4(bytes); | 250 | vjsParsed = videojs.inspectMp4(bytes); |
246 | console.log('transmuxed', vjsParsed); | 251 | console.log('transmuxed', vjsParsed); |
247 | diffParsed(); | 252 | diffParsed(); |
... | @@ -256,14 +261,7 @@ | ... | @@ -256,14 +261,7 @@ |
256 | vjsOutput.innerHTML = hex; | 261 | vjsOutput.innerHTML = hex; |
257 | 262 | ||
258 | // XXX Media Sources Testing | 263 | // XXX Media Sources Testing |
259 | window.vjsSourceBuffer.addEventListener('updateend', function() { | 264 | window.vjsSourceBuffer.appendBuffer(bytes); |
260 | if (!done) { | ||
261 | window.vjsSourceBuffer.appendBuffer(events[1]); | ||
262 | console.log('appended tmuxed output'); | ||
263 | done = true; | ||
264 | } | ||
265 | }); | ||
266 | window.vjsSourceBuffer.appendBuffer(events[0]); | ||
267 | }); | 265 | }); |
268 | reader.readAsArrayBuffer(this.files[0]); | 266 | reader.readAsArrayBuffer(this.files[0]); |
269 | }, false); | 267 | }, false); |
... | @@ -275,6 +273,7 @@ | ... | @@ -275,6 +273,7 @@ |
275 | bytes = new Uint8Array(reader.result); | 273 | bytes = new Uint8Array(reader.result); |
276 | 274 | ||
277 | 275 | ||
276 | workingBytes = bytes; | ||
278 | workingParsed = videojs.inspectMp4(bytes); | 277 | workingParsed = videojs.inspectMp4(bytes); |
279 | console.log('working', workingParsed); | 278 | console.log('working', workingParsed); |
280 | diffParsed(); | 279 | diffParsed(); |
... | @@ -289,7 +288,7 @@ | ... | @@ -289,7 +288,7 @@ |
289 | workingOutput.innerHTML = hex; | 288 | workingOutput.innerHTML = hex; |
290 | 289 | ||
291 | // XXX Media Sources Testing | 290 | // XXX Media Sources Testing |
292 | // window.vjsSourceBuffer.appendBuffer(bytes); | 291 | //window.vjsSourceBuffer.appendBuffer(bytes); |
293 | }); | 292 | }); |
294 | reader.readAsArrayBuffer(this.files[0]); | 293 | reader.readAsArrayBuffer(this.files[0]); |
295 | }, false); | 294 | }, false); | ... | ... |
-
Please register or sign in to post a comment