mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-13 15:46:46 +03:00
fix(ABR): Fix playbackRate calculation when using droppedFrames (#10011)
This commit is contained in:
committed by
GitHub
parent
82e914740c
commit
62ea2f6c5c
@@ -692,7 +692,9 @@ shaka.abr.SimpleAbrManager = class {
|
||||
|
||||
// Skip ban logic when playback rate is greater than 1x
|
||||
// because frame drops are expected or when the total frames are 0.
|
||||
if (this.mediaElement_.playbackRate > 1 || !currentTotal) {
|
||||
const playbackRate =
|
||||
!isNaN(this.playbackRate_) ? Math.abs(this.playbackRate_) : 1;
|
||||
if (playbackRate > 1 || !currentTotal) {
|
||||
this.lastDroppedFrames_ = currentDropped;
|
||||
this.lastTotalFrames_ = currentTotal;
|
||||
return;
|
||||
|
||||
@@ -474,7 +474,7 @@ describe('SimpleAbrManager', () => {
|
||||
abrManager.checkDroppedFrames_();
|
||||
|
||||
// High drop ratio at 2x speed — ban logic should be skipped.
|
||||
mockVideo.playbackRate = 2;
|
||||
abrManager.playbackRateChanged(2);
|
||||
mockVideo.getVideoPlaybackQuality = () => makeQuality(50, 200);
|
||||
abrManager.checkDroppedFrames_();
|
||||
|
||||
@@ -486,12 +486,12 @@ describe('SimpleAbrManager', () => {
|
||||
abrManager.checkDroppedFrames_();
|
||||
|
||||
// 2x speed: counters are reset to current values (50, 200).
|
||||
mockVideo.playbackRate = 2;
|
||||
abrManager.playbackRateChanged(2);
|
||||
mockVideo.getVideoPlaybackQuality = () => makeQuality(50, 200);
|
||||
abrManager.checkDroppedFrames_();
|
||||
|
||||
// Back to 1x: 5/100 new drops = 5% < 15% threshold.
|
||||
mockVideo.playbackRate = 1;
|
||||
abrManager.playbackRateChanged(1);
|
||||
mockVideo.getVideoPlaybackQuality = () => makeQuality(55, 300);
|
||||
abrManager.checkDroppedFrames_();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user