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
5973359f39
commit
4c2a7ed02d
23 changed files with 228 additions and 129 deletions
|
@ -390,29 +390,28 @@ class MSEMediaController extends EventHandler {
|
|||
break;
|
||||
case State.PARSED:
|
||||
case State.APPENDING:
|
||||
if (this.sourceBuffer) {
|
||||
var sourceBuffer = this.sourceBuffer, mp4segments = this.mp4segments;
|
||||
if (sourceBuffer) {
|
||||
if (this.media.error) {
|
||||
logger.error('trying to append although a media error occured, switch to ERROR state');
|
||||
this.state = State.ERROR;
|
||||
return;
|
||||
}
|
||||
// if MP4 segment appending in progress nothing to do
|
||||
else if ((this.sourceBuffer.audio && this.sourceBuffer.audio.updating) ||
|
||||
(this.sourceBuffer.video && this.sourceBuffer.video.updating)) {
|
||||
else if ((sourceBuffer.audio && sourceBuffer.audio.updating) ||
|
||||
(sourceBuffer.video && sourceBuffer.video.updating)) {
|
||||
//logger.log('sb append in progress');
|
||||
// check if any MP4 segments left to append
|
||||
} else if (this.mp4segments.length) {
|
||||
var segment = this.mp4segments.shift();
|
||||
} else if (mp4segments.length) {
|
||||
var segment = mp4segments.shift();
|
||||
try {
|
||||
//logger.log(`appending ${segment.type} SB, size:${segment.data.length});
|
||||
this.sourceBuffer[segment.type].appendBuffer(segment.data);
|
||||
sourceBuffer[segment.type].appendBuffer(segment.data);
|
||||
this.appendError = 0;
|
||||
} catch(err) {
|
||||
// in case any error occured while appending, put back segment in mp4segments table
|
||||
logger.error(`error while trying to append buffer:${err.message},try appending later`);
|
||||
this.mp4segments.unshift(segment);
|
||||
// just discard QuotaExceededError for now, and wait for the natural browser buffer eviction
|
||||
//http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror
|
||||
mp4segments.unshift(segment);
|
||||
if(err.code !== 22) {
|
||||
if (this.appendError) {
|
||||
this.appendError++;
|
||||
|
@ -420,9 +419,6 @@ class MSEMediaController extends EventHandler {
|
|||
this.appendError = 1;
|
||||
}
|
||||
var event = {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.BUFFER_APPEND_ERROR, frag: this.fragCurrent};
|
||||
/* with UHD content, we could get loop of quota exceeded error until
|
||||
browser is able to evict some data from sourcebuffer. retrying help recovering this
|
||||
*/
|
||||
if (this.appendError > this.config.appendErrorMaxRetry) {
|
||||
logger.log(`fail ${this.config.appendErrorMaxRetry} times to append segment in sourceBuffer`);
|
||||
event.fatal = true;
|
||||
|
@ -433,6 +429,15 @@ class MSEMediaController extends EventHandler {
|
|||
event.fatal = false;
|
||||
hls.trigger(Event.ERROR, event);
|
||||
}
|
||||
} else {
|
||||
// handle QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror
|
||||
// let's stop appending any segments, and trigger a smooth level switch to empty buffers
|
||||
// also reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
|
||||
mp4segments = [];
|
||||
this.config.maxMaxBufferLength/=2;
|
||||
logger.warn(`reduce max buffer length to ${this.config.maxMaxBufferLength}s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError`);
|
||||
this.nextLevelSwitch();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.state = State.APPENDING;
|
||||
|
@ -1022,7 +1027,7 @@ class MSEMediaController extends EventHandler {
|
|||
start = fragCurrent.start,
|
||||
level = fragCurrent.level,
|
||||
sn = fragCurrent.sn,
|
||||
audioCodec = currentLevel.audioCodec;
|
||||
audioCodec = currentLevel.audioCodec || this.config.defaultAudioCodec;
|
||||
if(this.audioCodecSwap) {
|
||||
logger.log('swapping playlist audio codec');
|
||||
if(audioCodec === undefined) {
|
||||
|
@ -1123,8 +1128,18 @@ class MSEMediaController extends EventHandler {
|
|||
|
||||
onFragParsed() {
|
||||
if (this.state === State.PARSING) {
|
||||
this.state = State.PARSED;
|
||||
this.stats.tparsed = performance.now();
|
||||
|
||||
var sb = this.sourceBuffer,
|
||||
appending = ((sb.audio && sb.audio.updating) ||
|
||||
(sb.video && sb.video.updating));
|
||||
|
||||
// if fragment parsed, and all segments appended, and no appending in progress, we are done with this fragment
|
||||
if (this.mp4segments.length === 0 && !appending) {
|
||||
this.state = State.IDLE;
|
||||
} else {
|
||||
this.state = State.PARSED;
|
||||
}
|
||||
//trigger handler right now
|
||||
this.tick();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue