Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make gap jump timer time configurable #5525

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/common/message_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ shakaDemo.MessageIds = {
FORCE_TRANSMUX: 'DEMO_FORCE_TRANSMUX',
FUZZ_FACTOR: 'DEMO_FUZZ_FACTOR',
GAP_DETECTION_THRESHOLD: 'DEMO_GAP_DETECTION_THRESHOLD',
GAP_JUMP_TIMER_TIME: 'DEMO_GAP_JUMP_TIMER_TIME',
HDR_LEVEL: 'DEMO_HDR_LEVEL',
HDR_LEVEL_AUTO: 'DEMO_HDR_LEVEL_AUTO',
HDR_LEVEL_HLG: 'DEMO_HDR_LEVEL_HLG',
Expand Down
3 changes: 3 additions & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ shakaDemo.Config = class {
.addNumberInput_(MessageIds.GAP_DETECTION_THRESHOLD,
'streaming.gapDetectionThreshold',
/* canBeDecimal= */ true)
.addNumberInput_(MessageIds.GAP_JUMP_TIMER_TIME,
'streaming.gapJumpTimerTime',
/* canBeDecimal= */ true)
.addNumberInput_(MessageIds.BUFFERING_GOAL,
'streaming.bufferingGoal',
/* canBeDecimal= */ true)
Expand Down
1 change: 1 addition & 0 deletions demo/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"DEMO_FRONT_INTRO_TWO": "Choose a video to playback; more assets are available via the \"all content\" tab.",
"DEMO_FUZZ_FACTOR": "Fuzz Factor",
"DEMO_GAP_DETECTION_THRESHOLD": "Gap detection threshold",
"DEMO_GAP_JUMP_TIMER_TIME": "Gap jump timer time",
"DEMO_GPAC": "GPAC",
"DEMO_HEADERS_TAB": "Headers",
"DEMO_HDR_LEVEL": "Preferred HDR Level",
Expand Down
4 changes: 4 additions & 0 deletions demo/locales/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
"description": "The name of a configuration value.",
"message": "Gap detection threshold"
},
"DEMO_GAP_JUMP_TIMER_TIME": {
"description": "The name of a configuration value.",
"message": "Gap jump timer time"
},
"DEMO_GPAC": {
"description": "Text that describes an asset that comes from the GPAC project asset library.",
"message": "[PROPER_NAME:GPAC]"
Expand Down
9 changes: 6 additions & 3 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ shaka.extern.ManifestConfiguration;
* alwaysStreamText: boolean,
* startAtSegmentBoundary: boolean,
* gapDetectionThreshold: number,
* gapJumpTimerTime: number,
* durationBackoff: number,
* safeSeekOffset: number,
* stallEnabled: boolean,
Expand Down Expand Up @@ -1127,9 +1128,11 @@ shaka.extern.ManifestConfiguration;
* time for live streams. This can put us further from the live edge. Defaults
* to <code>false</code>.
* @property {number} gapDetectionThreshold
* TThe maximum distance (in seconds) before a gap when we'll automatically
* jump. This value defaults to <code>0.1</code>, except in Edge Legacy,
* Tizen, Chromecast that value defaults value is <code>0.5</code>
* The maximum distance (in seconds) before a gap when we'll automatically
* jump. This value defaults to <code>0.5</code>.
* @property {number} gapJumpTimerTime
* The polling time in seconds to check for gaps in the media. This value
* defaults to <code>0.25</code>.
* @property {number} durationBackoff
* By default, we will not allow seeking to exactly the duration of a
* presentation. This field is the number of seconds before duration we will
Expand Down
2 changes: 1 addition & 1 deletion lib/media/gap_jumping_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ shaka.media.GapJumpingController = class {
*/
this.gapJumpTimer_ = new shaka.util.Timer(() => {
this.onPollGapJump_();
}).tickEvery(/* seconds= */ 0.25);
}).tickEvery(this.config_.gapJumpTimerTime);
}


Expand Down
1 change: 1 addition & 0 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ shaka.util.PlayerConfiguration = class {
alwaysStreamText: false,
startAtSegmentBoundary: false,
gapDetectionThreshold: 0.5,
gapJumpTimerTime: 0.25 /* seconds */,
durationBackoff: 1,
// Offset by 5 seconds since Chromecast takes a few seconds to start
// playing after a seek, even when buffered.
Expand Down