mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
53c2a5fe3c
commit
24ad560e5a
16 changed files with 223 additions and 126 deletions
|
@ -37,6 +37,8 @@
|
|||
switchLevel() {
|
||||
this.pmtParsed = false;
|
||||
this._pmtId = -1;
|
||||
this.lastAacPTS = null;
|
||||
this.aacOverFlow = null;
|
||||
this._avcTrack = {type: 'video', id :-1, sequenceNumber: 0, samples : [], len : 0, nbNalu : 0};
|
||||
this._aacTrack = {type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};
|
||||
this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0};
|
||||
|
@ -412,7 +414,7 @@
|
|||
case 3:
|
||||
if( value === 0) {
|
||||
state = 3;
|
||||
} else if (value === 1) {
|
||||
} else if (value === 1 && i < len) {
|
||||
unitType = array[i] & 0x1f;
|
||||
//logger.log('find NALU @ offset:' + i + ',type:' + unitType);
|
||||
if (lastUnitStart) {
|
||||
|
@ -469,11 +471,14 @@
|
|||
startOffset = 0,
|
||||
duration = this._duration,
|
||||
audioCodec = this.audioCodec,
|
||||
aacOverFlow = this.aacOverFlow,
|
||||
lastAacPTS = this.lastAacPTS,
|
||||
config, frameLength, frameDuration, frameIndex, offset, headerLength, stamp, len, aacSample;
|
||||
if (this.aacOverFlow) {
|
||||
var tmp = new Uint8Array(this.aacOverFlow.byteLength + data.byteLength);
|
||||
tmp.set(this.aacOverFlow, 0);
|
||||
tmp.set(data, this.aacOverFlow.byteLength);
|
||||
if (aacOverFlow) {
|
||||
var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);
|
||||
tmp.set(aacOverFlow, 0);
|
||||
tmp.set(data, aacOverFlow.byteLength);
|
||||
//logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);
|
||||
data = tmp;
|
||||
}
|
||||
// look for ADTS header (0xFFFx)
|
||||
|
@ -509,6 +514,17 @@
|
|||
}
|
||||
frameIndex = 0;
|
||||
frameDuration = 1024 * 90000 / track.audiosamplerate;
|
||||
|
||||
// if last AAC frame is overflowing, we should ensure timestamps are contiguous:
|
||||
// first sample PTS should be equal to last sample PTS + frameDuration
|
||||
if(aacOverFlow && lastAacPTS) {
|
||||
var newPTS = lastAacPTS+frameDuration;
|
||||
if(Math.abs(newPTS-pts) > 1) {
|
||||
logger.log(`AAC: align PTS for overlapping frames by ${Math.round((newPTS-pts)/90)}`);
|
||||
pts=newPTS;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -517,11 +533,11 @@
|
|||
(data[offset + 4] << 3) |
|
||||
((data[offset + 5] & 0xE0) >>> 5);
|
||||
frameLength -= headerLength;
|
||||
stamp = Math.round(pts + frameIndex * frameDuration);
|
||||
//stamp = pes.pts;
|
||||
|
||||
//console.log('AAC frame, offset/length/pts:' + (offset+headerLength) + '/' + frameLength + '/' + stamp.toFixed(0));
|
||||
if ((frameLength > 0) && ((offset + headerLength + frameLength) <= len)) {
|
||||
stamp = Math.round(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 += frameLength;
|
||||
|
@ -538,10 +554,13 @@
|
|||
}
|
||||
}
|
||||
if (offset < len) {
|
||||
this.aacOverFlow = data.subarray(offset, len);
|
||||
aacOverFlow = data.subarray(offset, len);
|
||||
//logger.log(`AAC: overflow detected:${len-offset}`);
|
||||
} else {
|
||||
this.aacOverFlow = null;
|
||||
aacOverFlow = null;
|
||||
}
|
||||
this.aacOverFlow = aacOverFlow;
|
||||
this.lastAacPTS = stamp;
|
||||
}
|
||||
|
||||
_parseID3PES(pes) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue