mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
Conflicts: MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/.bower.json MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/CHANGELOG.md MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/LICENSE MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/components.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/components/prism-core.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/components/prism-core.min.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/components/prism-jsx.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/components/prism-jsx.min.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/package.json MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/file-highlight/prism-file-highlight.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/file-highlight/prism-file-highlight.min.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/show-invisibles/prism-show-invisibles.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/show-invisibles/prism-show-invisibles.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/show-invisibles/prism-show-invisibles.min.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/show-language/prism-show-language.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/show-language/prism-show-language.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/show-language/prism-show-language.min.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/wpd/prism-wpd.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/plugins/wpd/prism-wpd.min.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/prism.js MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism-coy.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism-dark.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism-funky.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism-okaidia.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism-tomorrow.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism-twilight.css MediaBrowser.WebDashboard/dashboard-ui/bower_components/prism/themes/prism.css
This commit is contained in:
parent
df4c86218e
commit
be5906a13e
54 changed files with 570 additions and 641 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "hls.js",
|
||||
"version": "0.4.8",
|
||||
"version": "0.4.9",
|
||||
"license": "Apache-2.0",
|
||||
"description": "Media Source Extension - HLS library, by/for Dailymotion",
|
||||
"homepage": "https://github.com/dailymotion/hls.js",
|
||||
"authors": [
|
||||
|
@ -15,11 +16,11 @@
|
|||
"test",
|
||||
"tests"
|
||||
],
|
||||
"_release": "0.4.8",
|
||||
"_release": "0.4.9",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.4.8",
|
||||
"commit": "de1534ca184ffa3a313fc5b433713512f6ab1c27"
|
||||
"tag": "v0.4.9",
|
||||
"commit": "11f271bfa1f17571756d1b4cf79271c45035bbbf"
|
||||
},
|
||||
"_source": "git://github.com/dailymotion/hls.js.git",
|
||||
"_target": "~0.4.5",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "hls.js",
|
||||
"version": "0.4.8",
|
||||
"version": "0.4.9",
|
||||
"license" : "Apache-2.0",
|
||||
"description": "Media Source Extension - HLS library, by/for Dailymotion",
|
||||
"homepage": "https://github.com/dailymotion/hls.js",
|
||||
"authors": [
|
||||
|
|
110
dashboard-ui/bower_components/hls.js/dist/hls.js
vendored
110
dashboard-ui/bower_components/hls.js/dist/hls.js
vendored
|
@ -881,13 +881,15 @@ var MSEMediaController = (function (_EventHandler) {
|
|||
}, {
|
||||
key: 'startLoad',
|
||||
value: function startLoad() {
|
||||
if (this.levels && this.media) {
|
||||
if (this.levels) {
|
||||
this.startInternal();
|
||||
if (this.lastCurrentTime) {
|
||||
_utilsLogger.logger.log('seeking @ ' + this.lastCurrentTime);
|
||||
var media = this.media,
|
||||
lastCurrentTime = this.lastCurrentTime;
|
||||
if (media && lastCurrentTime) {
|
||||
_utilsLogger.logger.log('seeking @ ' + lastCurrentTime);
|
||||
if (!this.lastPaused) {
|
||||
_utilsLogger.logger.log('resuming video');
|
||||
this.media.play();
|
||||
media.play();
|
||||
}
|
||||
this.state = State.IDLE;
|
||||
} else {
|
||||
|
@ -897,7 +899,7 @@ var MSEMediaController = (function (_EventHandler) {
|
|||
this.nextLoadPosition = this.startPosition = this.lastCurrentTime;
|
||||
this.tick();
|
||||
} else {
|
||||
_utilsLogger.logger.warn('cannot start loading as either manifest not parsed or video not attached');
|
||||
_utilsLogger.logger.warn('cannot start loading as manifest not parsed yet');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
@ -1486,7 +1488,7 @@ var MSEMediaController = (function (_EventHandler) {
|
|||
to avoid rounding issues/infinite loop,
|
||||
only flush buffer range of length greater than 500ms.
|
||||
*/
|
||||
if (flushEnd - flushStart > 0.5) {
|
||||
if (Math.min(flushEnd, bufEnd) - flushStart > 0.5) {
|
||||
_utilsLogger.logger.log('flush ' + type + ' [' + flushStart + ',' + flushEnd + '], of [' + bufStart + ',' + bufEnd + '], pos:' + this.media.currentTime);
|
||||
sb.remove(flushStart, flushEnd);
|
||||
return false;
|
||||
|
@ -1499,6 +1501,8 @@ var MSEMediaController = (function (_EventHandler) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_utilsLogger.logger.warn('abort flushing too many retries');
|
||||
}
|
||||
|
||||
/* after successful buffer flushing, rebuild buffer Range array
|
||||
|
@ -2063,7 +2067,7 @@ var MSEMediaController = (function (_EventHandler) {
|
|||
jumpThreshold = 0;
|
||||
} else {
|
||||
// playhead not moving AND media playing
|
||||
_utilsLogger.logger.log('playback seems stuck');
|
||||
_utilsLogger.logger.log('playback seems stuck @' + currentTime);
|
||||
if (!this.stalled) {
|
||||
this.hls.trigger(_events2['default'].ERROR, { type: _errors.ErrorTypes.MEDIA_ERROR, details: _errors.ErrorDetails.BUFFER_STALLED_ERROR, fatal: false });
|
||||
this.stalled = true;
|
||||
|
@ -2850,52 +2854,52 @@ var AACDemuxer = (function () {
|
|||
id3 = new _demuxId32['default'](data),
|
||||
pts = 90 * id3.timeStamp,
|
||||
config,
|
||||
adtsFrameSize,
|
||||
adtsStartOffset,
|
||||
adtsHeaderLen,
|
||||
frameLength,
|
||||
frameDuration,
|
||||
frameIndex,
|
||||
offset,
|
||||
headerLength,
|
||||
stamp,
|
||||
nbSamples,
|
||||
len,
|
||||
aacSample;
|
||||
// look for ADTS header (0xFFFx)
|
||||
for (adtsStartOffset = id3.length, len = data.length; adtsStartOffset < len - 1; adtsStartOffset++) {
|
||||
if (data[adtsStartOffset] === 0xff && (data[adtsStartOffset + 1] & 0xf0) === 0xf0) {
|
||||
for (offset = id3.length, len = data.length; offset < len - 1; offset++) {
|
||||
if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!track.audiosamplerate) {
|
||||
config = _adts2['default'].getAudioConfig(this.observer, data, adtsStartOffset, audioCodec);
|
||||
config = _adts2['default'].getAudioConfig(this.observer, data, offset, audioCodec);
|
||||
track.config = config.config;
|
||||
track.audiosamplerate = config.samplerate;
|
||||
track.channelCount = config.channelCount;
|
||||
track.codec = config.codec;
|
||||
track.timescale = this.remuxer.timescale;
|
||||
track.duration = this.remuxer.timescale * duration;
|
||||
track.timescale = config.samplerate;
|
||||
track.duration = config.samplerate * duration;
|
||||
_utilsLogger.logger.log('parsed codec:' + track.codec + ',rate:' + config.samplerate + ',nb channel:' + config.channelCount);
|
||||
}
|
||||
nbSamples = 0;
|
||||
while (adtsStartOffset + 5 < len) {
|
||||
frameIndex = 0;
|
||||
frameDuration = 1024 * 90000 / track.audiosamplerate;
|
||||
while (offset + 5 < len) {
|
||||
// The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header
|
||||
headerLength = !!(data[offset + 1] & 0x01) ? 7 : 9;
|
||||
// retrieve frame size
|
||||
adtsFrameSize = (data[adtsStartOffset + 3] & 0x03) << 11;
|
||||
// byte 4
|
||||
adtsFrameSize |= data[adtsStartOffset + 4] << 3;
|
||||
// byte 5
|
||||
adtsFrameSize |= (data[adtsStartOffset + 5] & 0xE0) >>> 5;
|
||||
adtsHeaderLen = !!(data[adtsStartOffset + 1] & 0x01) ? 7 : 9;
|
||||
adtsFrameSize -= adtsHeaderLen;
|
||||
stamp = Math.round(pts + nbSamples * 1024 * 90000 / track.audiosamplerate);
|
||||
frameLength = (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5;
|
||||
frameLength -= headerLength;
|
||||
//stamp = pes.pts;
|
||||
//console.log('AAC frame, offset/length/pts:' + (adtsStartOffset+7) + '/' + adtsFrameSize + '/' + stamp.toFixed(0));
|
||||
if (adtsFrameSize > 0 && adtsStartOffset + adtsHeaderLen + adtsFrameSize <= len) {
|
||||
aacSample = { unit: data.subarray(adtsStartOffset + adtsHeaderLen, adtsStartOffset + adtsHeaderLen + adtsFrameSize), pts: stamp, dts: stamp };
|
||||
|
||||
if (frameLength > 0 && offset + headerLength + frameLength <= len) {
|
||||
stamp = pts + frameIndex * frameDuration;
|
||||
//logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);
|
||||
aacSample = { unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp };
|
||||
track.samples.push(aacSample);
|
||||
track.len += adtsFrameSize;
|
||||
adtsStartOffset += adtsFrameSize + adtsHeaderLen;
|
||||
nbSamples++;
|
||||
track.len += frameLength;
|
||||
offset += frameLength + headerLength;
|
||||
frameIndex++;
|
||||
// look for ADTS header (0xFFFx)
|
||||
for (; adtsStartOffset < len - 1; adtsStartOffset++) {
|
||||
if (data[adtsStartOffset] === 0xff && (data[adtsStartOffset + 1] & 0xf0) === 0xf0) {
|
||||
for (; offset < len - 1; offset++) {
|
||||
if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2913,12 +2917,12 @@ var AACDemuxer = (function () {
|
|||
value: function probe(data) {
|
||||
// check if data contains ID3 timestamp and ADTS sync worc
|
||||
var id3 = new _demuxId32['default'](data),
|
||||
adtsStartOffset,
|
||||
offset,
|
||||
len;
|
||||
if (id3.hasTimeStamp) {
|
||||
// look for ADTS header (0xFFFx)
|
||||
for (adtsStartOffset = id3.length, len = data.length; adtsStartOffset < len - 1; adtsStartOffset++) {
|
||||
if (data[adtsStartOffset] === 0xff && (data[adtsStartOffset + 1] & 0xf0) === 0xf0) {
|
||||
for (offset = id3.length, len = data.length; offset < len - 1; offset++) {
|
||||
if (data[offset] === 0xff && (data[offset + 1] & 0xf0) === 0xf0) {
|
||||
//logger.log('ADTS sync word found !');
|
||||
return true;
|
||||
}
|
||||
|
@ -4553,8 +4557,8 @@ var TSDemuxer = (function () {
|
|||
track.audiosamplerate = config.samplerate;
|
||||
track.channelCount = config.channelCount;
|
||||
track.codec = config.codec;
|
||||
track.timescale = this.remuxer.timescale;
|
||||
track.duration = track.timescale * duration;
|
||||
track.timescale = config.samplerate;
|
||||
track.duration = config.samplerate * duration;
|
||||
_utilsLogger.logger.log('parsed codec:' + track.codec + ',rate:' + config.samplerate + ',nb channel:' + config.channelCount);
|
||||
}
|
||||
frameIndex = 0;
|
||||
|
@ -4579,7 +4583,7 @@ var TSDemuxer = (function () {
|
|||
//stamp = pes.pts;
|
||||
|
||||
if (frameLength > 0 && offset + headerLength + frameLength <= len) {
|
||||
stamp = Math.round(pts + frameIndex * frameDuration);
|
||||
stamp = pts + frameIndex * frameDuration;
|
||||
//logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);
|
||||
aacSample = { unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp };
|
||||
track.samples.push(aacSample);
|
||||
|
@ -5076,7 +5080,7 @@ var Hls = (function () {
|
|||
debug: false,
|
||||
maxBufferLength: 30,
|
||||
maxBufferSize: 60 * 1000 * 1000,
|
||||
maxBufferHole: 0.3,
|
||||
maxBufferHole: 0.5,
|
||||
maxSeekHole: 2,
|
||||
liveSyncDurationCount: 3,
|
||||
liveMaxLatencyDurationCount: Infinity,
|
||||
|
@ -6674,7 +6678,8 @@ var MP4Remuxer = (function () {
|
|||
var view,
|
||||
offset = 8,
|
||||
pesTimeScale = this.PES_TIMESCALE,
|
||||
pes2mp4ScaleFactor = this.PES2MP4SCALEFACTOR,
|
||||
mp4timeScale = track.timescale,
|
||||
pes2mp4ScaleFactor = pesTimeScale / mp4timeScale,
|
||||
aacSample,
|
||||
mp4Sample,
|
||||
unit,
|
||||
|
@ -6690,15 +6695,10 @@ var MP4Remuxer = (function () {
|
|||
samples = [],
|
||||
samples0 = [];
|
||||
|
||||
track.samples.forEach(function (aacSample) {
|
||||
if (pts === undefined || aacSample.pts > pts) {
|
||||
samples0.push(aacSample);
|
||||
pts = aacSample.pts;
|
||||
} else {
|
||||
_utilsLogger.logger.warn('dropping past audio frame');
|
||||
track.len -= aacSample.unit.byteLength;
|
||||
}
|
||||
track.samples.sort(function (a, b) {
|
||||
return a.pts - b.pts;
|
||||
});
|
||||
samples0 = track.samples;
|
||||
|
||||
while (samples0.length) {
|
||||
aacSample = samples0.shift();
|
||||
|
@ -6710,13 +6710,15 @@ var MP4Remuxer = (function () {
|
|||
if (lastDTS !== undefined) {
|
||||
ptsnorm = this._PTSNormalize(pts, lastDTS);
|
||||
dtsnorm = this._PTSNormalize(dts, lastDTS);
|
||||
// let's compute sample duration
|
||||
// let's compute sample duration.
|
||||
// there should be 1024 audio samples in one AAC frame
|
||||
mp4Sample.duration = (dtsnorm - lastDTS) / pes2mp4ScaleFactor;
|
||||
if (mp4Sample.duration < 0) {
|
||||
if (Math.abs(mp4Sample.duration - 1024) > 10) {
|
||||
// not expected to happen ...
|
||||
_utilsLogger.logger.log('invalid AAC sample duration at PTS:' + aacSample.pts + ':' + mp4Sample.duration);
|
||||
mp4Sample.duration = 0;
|
||||
_utilsLogger.logger.log('invalid AAC sample duration at PTS ' + Math.round(pts / 90) + ',should be 1024,found :' + Math.round(mp4Sample.duration));
|
||||
}
|
||||
mp4Sample.duration = 1024;
|
||||
dtsnorm = 1024 * pes2mp4ScaleFactor + lastDTS;
|
||||
} else {
|
||||
var nextAacPts = this.nextAacPts,
|
||||
delta;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "hls.js",
|
||||
"version": "0.4.8",
|
||||
"version": "0.4.9",
|
||||
"license" : "Apache-2.0",
|
||||
"description": "Media Source Extension - HLS library, by/for Dailymotion",
|
||||
"homepage": "https://github.com/dailymotion/hls.js",
|
||||
"authors": "Guillaume du Pontavice <guillaume.dupontavice@dailymotion.com>",
|
||||
|
@ -12,7 +13,7 @@
|
|||
"url": "https://github.com/dailymotion/hls.js/issues"
|
||||
},
|
||||
"main": "src/hls.js",
|
||||
"private": true,
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"clean": "find dist -mindepth 1 -delete",
|
||||
"prebuild": "npm run clean & npm run test",
|
||||
|
|
|
@ -54,13 +54,14 @@ class MSEMediaController extends EventHandler {
|
|||
}
|
||||
|
||||
startLoad() {
|
||||
if (this.levels && this.media) {
|
||||
if (this.levels) {
|
||||
this.startInternal();
|
||||
if (this.lastCurrentTime) {
|
||||
logger.log(`seeking @ ${this.lastCurrentTime}`);
|
||||
var media = this.media, lastCurrentTime = this.lastCurrentTime;
|
||||
if (media && lastCurrentTime) {
|
||||
logger.log(`seeking @ ${lastCurrentTime}`);
|
||||
if (!this.lastPaused) {
|
||||
logger.log('resuming video');
|
||||
this.media.play();
|
||||
media.play();
|
||||
}
|
||||
this.state = State.IDLE;
|
||||
} else {
|
||||
|
@ -70,7 +71,7 @@ class MSEMediaController extends EventHandler {
|
|||
this.nextLoadPosition = this.startPosition = this.lastCurrentTime;
|
||||
this.tick();
|
||||
} else {
|
||||
logger.warn('cannot start loading as either manifest not parsed or video not attached');
|
||||
logger.warn('cannot start loading as manifest not parsed yet');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,7 +667,7 @@ class MSEMediaController extends EventHandler {
|
|||
to avoid rounding issues/infinite loop,
|
||||
only flush buffer range of length greater than 500ms.
|
||||
*/
|
||||
if (flushEnd - flushStart > 0.5) {
|
||||
if (Math.min(flushEnd,bufEnd) - flushStart > 0.5) {
|
||||
logger.log(`flush ${type} [${flushStart},${flushEnd}], of [${bufStart},${bufEnd}], pos:${this.media.currentTime}`);
|
||||
sb.remove(flushStart, flushEnd);
|
||||
return false;
|
||||
|
@ -679,6 +680,8 @@ class MSEMediaController extends EventHandler {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.warn('abort flushing too many retries');
|
||||
}
|
||||
|
||||
/* after successful buffer flushing, rebuild buffer Range array
|
||||
|
@ -1221,7 +1224,7 @@ _checkBuffer() {
|
|||
jumpThreshold = 0;
|
||||
} else {
|
||||
// playhead not moving AND media playing
|
||||
logger.log('playback seems stuck');
|
||||
logger.log(`playback seems stuck @${currentTime}`);
|
||||
if(!this.stalled) {
|
||||
this.hls.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_STALLED_ERROR, fatal: false});
|
||||
this.stalled = true;
|
||||
|
|
|
@ -16,11 +16,11 @@ import ID3 from '../demux/id3';
|
|||
|
||||
static probe(data) {
|
||||
// check if data contains ID3 timestamp and ADTS sync worc
|
||||
var id3 = new ID3(data), adtsStartOffset,len;
|
||||
var id3 = new ID3(data), offset,len;
|
||||
if(id3.hasTimeStamp) {
|
||||
// look for ADTS header (0xFFFx)
|
||||
for (adtsStartOffset = id3.length, len = data.length; adtsStartOffset < len - 1; adtsStartOffset++) {
|
||||
if ((data[adtsStartOffset] === 0xff) && (data[adtsStartOffset+1] & 0xf0) === 0xf0) {
|
||||
for (offset = id3.length, len = data.length; offset < len - 1; offset++) {
|
||||
if ((data[offset] === 0xff) && (data[offset+1] & 0xf0) === 0xf0) {
|
||||
//logger.log('ADTS sync word found !');
|
||||
return true;
|
||||
}
|
||||
|
@ -35,46 +35,47 @@ import ID3 from '../demux/id3';
|
|||
var track = this._aacTrack,
|
||||
id3 = new ID3(data),
|
||||
pts = 90*id3.timeStamp,
|
||||
config, adtsFrameSize, adtsStartOffset, adtsHeaderLen, stamp, nbSamples, len, aacSample;
|
||||
config, frameLength, frameDuration, frameIndex, offset, headerLength, stamp, len, aacSample;
|
||||
// look for ADTS header (0xFFFx)
|
||||
for (adtsStartOffset = id3.length, len = data.length; adtsStartOffset < len - 1; adtsStartOffset++) {
|
||||
if ((data[adtsStartOffset] === 0xff) && (data[adtsStartOffset+1] & 0xf0) === 0xf0) {
|
||||
for (offset = id3.length, len = data.length; offset < len - 1; offset++) {
|
||||
if ((data[offset] === 0xff) && (data[offset+1] & 0xf0) === 0xf0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!track.audiosamplerate) {
|
||||
config = ADTS.getAudioConfig(this.observer,data, adtsStartOffset, audioCodec);
|
||||
config = ADTS.getAudioConfig(this.observer,data, offset, audioCodec);
|
||||
track.config = config.config;
|
||||
track.audiosamplerate = config.samplerate;
|
||||
track.channelCount = config.channelCount;
|
||||
track.codec = config.codec;
|
||||
track.timescale = this.remuxer.timescale;
|
||||
track.duration = this.remuxer.timescale * duration;
|
||||
track.timescale = config.samplerate;
|
||||
track.duration = config.samplerate * duration;
|
||||
logger.log(`parsed codec:${track.codec},rate:${config.samplerate},nb channel:${config.channelCount}`);
|
||||
}
|
||||
nbSamples = 0;
|
||||
while ((adtsStartOffset + 5) < len) {
|
||||
frameIndex = 0;
|
||||
frameDuration = 1024 * 90000 / track.audiosamplerate;
|
||||
while ((offset + 5) < len) {
|
||||
// The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header
|
||||
headerLength = (!!(data[offset + 1] & 0x01) ? 7 : 9);
|
||||
// retrieve frame size
|
||||
adtsFrameSize = ((data[adtsStartOffset + 3] & 0x03) << 11);
|
||||
// byte 4
|
||||
adtsFrameSize |= (data[adtsStartOffset + 4] << 3);
|
||||
// byte 5
|
||||
adtsFrameSize |= ((data[adtsStartOffset + 5] & 0xE0) >>> 5);
|
||||
adtsHeaderLen = (!!(data[adtsStartOffset + 1] & 0x01) ? 7 : 9);
|
||||
adtsFrameSize -= adtsHeaderLen;
|
||||
stamp = Math.round(pts + nbSamples * 1024 * 90000 / track.audiosamplerate);
|
||||
frameLength = ((data[offset + 3] & 0x03) << 11) |
|
||||
(data[offset + 4] << 3) |
|
||||
((data[offset + 5] & 0xE0) >>> 5);
|
||||
frameLength -= headerLength;
|
||||
//stamp = pes.pts;
|
||||
//console.log('AAC frame, offset/length/pts:' + (adtsStartOffset+7) + '/' + adtsFrameSize + '/' + stamp.toFixed(0));
|
||||
if ((adtsFrameSize > 0) && ((adtsStartOffset + adtsHeaderLen + adtsFrameSize) <= len)) {
|
||||
aacSample = {unit: data.subarray(adtsStartOffset + adtsHeaderLen, adtsStartOffset + adtsHeaderLen + adtsFrameSize), pts: stamp, dts: stamp};
|
||||
|
||||
if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {
|
||||
stamp = pts + frameIndex * frameDuration;
|
||||
//logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);
|
||||
aacSample = {unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp};
|
||||
track.samples.push(aacSample);
|
||||
track.len += adtsFrameSize;
|
||||
adtsStartOffset += adtsFrameSize + adtsHeaderLen;
|
||||
nbSamples++;
|
||||
track.len += frameLength;
|
||||
offset += frameLength + headerLength;
|
||||
frameIndex++;
|
||||
// look for ADTS header (0xFFFx)
|
||||
for ( ; adtsStartOffset < (len - 1); adtsStartOffset++) {
|
||||
if ((data[adtsStartOffset] === 0xff) && ((data[adtsStartOffset + 1] & 0xf0) === 0xf0)) {
|
||||
for ( ; offset < (len - 1); offset++) {
|
||||
if ((data[offset] === 0xff) && ((data[offset + 1] & 0xf0) === 0xf0)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,8 +568,8 @@
|
|||
track.audiosamplerate = config.samplerate;
|
||||
track.channelCount = config.channelCount;
|
||||
track.codec = config.codec;
|
||||
track.timescale = this.remuxer.timescale;
|
||||
track.duration = track.timescale * duration;
|
||||
track.timescale = config.samplerate;
|
||||
track.duration = config.samplerate * duration;
|
||||
logger.log(`parsed codec:${track.codec},rate:${config.samplerate},nb channel:${config.channelCount}`);
|
||||
}
|
||||
frameIndex = 0;
|
||||
|
@ -596,7 +596,7 @@
|
|||
//stamp = pes.pts;
|
||||
|
||||
if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {
|
||||
stamp = Math.round(pts + frameIndex * frameDuration);
|
||||
stamp = pts + frameIndex * frameDuration;
|
||||
//logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);
|
||||
aacSample = {unit: data.subarray(offset + headerLength, offset + headerLength + frameLength), pts: stamp, dts: stamp};
|
||||
track.samples.push(aacSample);
|
||||
|
|
|
@ -42,7 +42,7 @@ class Hls {
|
|||
debug: false,
|
||||
maxBufferLength: 30,
|
||||
maxBufferSize: 60 * 1000 * 1000,
|
||||
maxBufferHole: 0.3,
|
||||
maxBufferHole: 0.5,
|
||||
maxSeekHole: 2,
|
||||
liveSyncDurationCount:3,
|
||||
liveMaxLatencyDurationCount: Infinity,
|
||||
|
|
|
@ -253,7 +253,8 @@ class MP4Remuxer {
|
|||
var view,
|
||||
offset = 8,
|
||||
pesTimeScale = this.PES_TIMESCALE,
|
||||
pes2mp4ScaleFactor = this.PES2MP4SCALEFACTOR,
|
||||
mp4timeScale = track.timescale,
|
||||
pes2mp4ScaleFactor = pesTimeScale/mp4timeScale,
|
||||
aacSample, mp4Sample,
|
||||
unit,
|
||||
mdat, moof,
|
||||
|
@ -262,15 +263,10 @@ class MP4Remuxer {
|
|||
samples = [],
|
||||
samples0 = [];
|
||||
|
||||
track.samples.forEach(aacSample => {
|
||||
if(pts === undefined || aacSample.pts > pts) {
|
||||
samples0.push(aacSample);
|
||||
pts = aacSample.pts;
|
||||
} else {
|
||||
logger.warn('dropping past audio frame');
|
||||
track.len -= aacSample.unit.byteLength;
|
||||
}
|
||||
track.samples.sort(function(a, b) {
|
||||
return (a.pts-b.pts);
|
||||
});
|
||||
samples0 = track.samples;
|
||||
|
||||
while (samples0.length) {
|
||||
aacSample = samples0.shift();
|
||||
|
@ -282,13 +278,15 @@ class MP4Remuxer {
|
|||
if (lastDTS !== undefined) {
|
||||
ptsnorm = this._PTSNormalize(pts, lastDTS);
|
||||
dtsnorm = this._PTSNormalize(dts, lastDTS);
|
||||
// let's compute sample duration
|
||||
// let's compute sample duration.
|
||||
// there should be 1024 audio samples in one AAC frame
|
||||
mp4Sample.duration = (dtsnorm - lastDTS) / pes2mp4ScaleFactor;
|
||||
if (mp4Sample.duration < 0) {
|
||||
if(Math.abs(mp4Sample.duration - 1024) > 10) {
|
||||
// not expected to happen ...
|
||||
logger.log(`invalid AAC sample duration at PTS:${aacSample.pts}:${mp4Sample.duration}`);
|
||||
mp4Sample.duration = 0;
|
||||
logger.log(`invalid AAC sample duration at PTS ${Math.round(pts/90)},should be 1024,found :${Math.round(mp4Sample.duration)}`);
|
||||
}
|
||||
mp4Sample.duration = 1024;
|
||||
dtsnorm = 1024 * pes2mp4ScaleFactor + lastDTS;
|
||||
} else {
|
||||
var nextAacPts = this.nextAacPts,delta;
|
||||
ptsnorm = this._PTSNormalize(pts, nextAacPts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue