From 65a6758cea6a06d799db89582542336597b88241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Wed, 23 Aug 2023 16:01:54 +0200 Subject: [PATCH 1/2] feat: Make gap jump timer time configurable --- demo/common/message_ids.js | 1 + demo/config.js | 3 +++ demo/locales/en.json | 1 + demo/locales/source.json | 4 ++++ externs/shaka/player.js | 8 +++++--- lib/media/gap_jumping_controller.js | 2 +- lib/util/player_configuration.js | 1 + 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/demo/common/message_ids.js b/demo/common/message_ids.js index 5d1c2405e6..ebec947d9e 100644 --- a/demo/common/message_ids.js +++ b/demo/common/message_ids.js @@ -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', diff --git a/demo/config.js b/demo/config.js index aaac157aa4..6070b3c36f 100644 --- a/demo/config.js +++ b/demo/config.js @@ -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) diff --git a/demo/locales/en.json b/demo/locales/en.json index baf59f685c..044476e90a 100644 --- a/demo/locales/en.json +++ b/demo/locales/en.json @@ -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", diff --git a/demo/locales/source.json b/demo/locales/source.json index 6aa5f75384..87ddde1b7b 100644 --- a/demo/locales/source.json +++ b/demo/locales/source.json @@ -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]" diff --git a/externs/shaka/player.js b/externs/shaka/player.js index 7bee748aa9..ea148b93b0 100644 --- a/externs/shaka/player.js +++ b/externs/shaka/player.js @@ -1069,6 +1069,7 @@ shaka.extern.ManifestConfiguration; * alwaysStreamText: boolean, * startAtSegmentBoundary: boolean, * gapDetectionThreshold: number, + * gapJumpTimerTime: number, * durationBackoff: number, * safeSeekOffset: number, * stallEnabled: boolean, @@ -1127,9 +1128,10 @@ shaka.extern.ManifestConfiguration; * time for live streams. This can put us further from the live edge. Defaults * to false. * @property {number} gapDetectionThreshold - * TThe maximum distance (in seconds) before a gap when we'll automatically - * jump. This value defaults to 0.1, except in Edge Legacy, - * Tizen, Chromecast that value defaults value is 0.5 + * The maximum distance (in seconds) before a gap when we'll automatically + * jump. This value defaults to 0.5. + * @property {numebr} gapJumpTimerTime + * The polling time in seconds to check for gaps in the media. * @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 diff --git a/lib/media/gap_jumping_controller.js b/lib/media/gap_jumping_controller.js index fa45c7979d..30d10b3a65 100644 --- a/lib/media/gap_jumping_controller.js +++ b/lib/media/gap_jumping_controller.js @@ -89,7 +89,7 @@ shaka.media.GapJumpingController = class { */ this.gapJumpTimer_ = new shaka.util.Timer(() => { this.onPollGapJump_(); - }).tickEvery(/* seconds= */ 0.25); + }).tickEvery(this.config_.gapJumpTimerTime); } diff --git a/lib/util/player_configuration.js b/lib/util/player_configuration.js index 9b0183011c..6233a9349e 100644 --- a/lib/util/player_configuration.js +++ b/lib/util/player_configuration.js @@ -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. From 25d8dd22cbdfded29195ca8cf491280dc3bd418f Mon Sep 17 00:00:00 2001 From: Alvaro Velad Galvan Date: Wed, 23 Aug 2023 19:51:44 +0200 Subject: [PATCH 2/2] Fix PR --- externs/shaka/player.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/externs/shaka/player.js b/externs/shaka/player.js index ea148b93b0..bf0a684820 100644 --- a/externs/shaka/player.js +++ b/externs/shaka/player.js @@ -1129,9 +1129,10 @@ shaka.extern.ManifestConfiguration; * to false. * @property {number} gapDetectionThreshold * The maximum distance (in seconds) before a gap when we'll automatically - * jump. This value defaults to 0.5. - * @property {numebr} gapJumpTimerTime - * The polling time in seconds to check for gaps in the media. + * jump. This value defaults to 0.5. + * @property {number} gapJumpTimerTime + * The polling time in seconds to check for gaps in the media. This value + * defaults to 0.25. * @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