| 80 | const baseline = quality.presentedFrames; |
| 81 | |
| 82 | const check = (old: number, now: number): void => { |
| 83 | const newquality = getPlaybackQuality(this); |
| 84 | const presentedFrames = newquality.presentedFrames; |
| 85 | |
| 86 | if (presentedFrames > baseline) { |
| 87 | const processingDuration = |
| 88 | newquality.totalFrameDelay - quality.totalFrameDelay || 0; |
| 89 | const timediff = now - old; |
| 90 | |
| 91 | callback(now, { |
| 92 | presentationTime: now + processingDuration * 1000, |
| 93 | expectedDisplayTime: now + timediff, |
| 94 | width: this.videoWidth, |
| 95 | height: this.videoHeight, |
| 96 | mediaTime: Math.max(0, this.currentTime || 0) + timediff / 1000, |
| 97 | presentedFrames, |
| 98 | processingDuration, |
| 99 | }); |
| 100 | |
| 101 | delete this._rvfcpolyfillmap?.[handle]; |
| 102 | } else { |
| 103 | this._rvfcpolyfillmap ??= {}; |
| 104 | this._rvfcpolyfillmap[handle] = requestAnimationFrame((newer) => |
| 105 | check(now, newer), |
| 106 | ); |
| 107 | } |
| 108 | }; |
| 109 | |
| 110 | this._rvfcpolyfillmap ??= {}; |
| 111 | this._rvfcpolyfillmap[handle] = requestAnimationFrame((newer) => |