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

Added liveUpdateTimeThreshold to control time syncing during live streams #4382

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import Events from './events/Events';
* abandonLoadTimeout: 10000,
* wallclockTimeUpdateInterval: 100,
* manifestUpdateRetryInterval: 100,
* liveUpdateTimeThreshold: 0,
matvp91 marked this conversation as resolved.
Show resolved Hide resolved
* cacheInitSegments: false,
* applyServiceDescription: true,
* applyProducerReferenceTime: true,
Expand Down Expand Up @@ -741,6 +742,8 @@ import Events from './events/Events';
* How frequently the wallclockTimeUpdated internal event is triggered (in milliseconds).
* @property {number} [manifestUpdateRetryInterval=100]
* For live streams, set the interval-frequency in milliseconds at which dash.js will check if the current manifest is still processed before downloading the next manifest once the minimumUpdatePeriod time has.
* @property {number} [liveUpdateTimeThreshold=0]
* For live streams, postpone syncing time updates until the threshold is passed. Increase if problems occurs during live streams on low end devices.
* @property {boolean} [cacheInitSegments=false]
* Enables the caching of init segments to avoid requesting the init segments before each representation switch.
* @property {boolean} [applyServiceDescription=true]
Expand Down Expand Up @@ -871,6 +874,7 @@ function Settings() {
abandonLoadTimeout: 10000,
wallclockTimeUpdateInterval: 100,
manifestUpdateRetryInterval: 100,
liveUpdateTimeThreshold: 0,
matvp91 marked this conversation as resolved.
Show resolved Hide resolved
cacheInitSegments: false,
applyServiceDescription: true,
applyProducerReferenceTime: true,
Expand Down
15 changes: 10 additions & 5 deletions src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function PlaybackController() {
isDynamic,
playOnceInitialized,
lastLivePlaybackTime,
lastLiveUpdateTime,
matvp91 marked this conversation as resolved.
Show resolved Hide resolved
availabilityStartTime,
availabilityTimeComplete,
lowLatencyModeEnabled,
Expand Down Expand Up @@ -723,11 +724,15 @@ function PlaybackController() {
// Updates playback time for paused dynamic streams
// (video element doesn't call timeupdate when the playback is paused)
if (getIsDynamic()) {
streamController.addDVRMetric();
if (isPaused()) {
_updateLivePlaybackTime();
} else {
updateCurrentTime();
const now = Date.now();
if (!lastLiveUpdateTime || now > lastLiveUpdateTime + settings.get().streaming.liveUpdateTimeThreshold) {
streamController.addDVRMetric();
if (isPaused()) {
_updateLivePlaybackTime();
} else {
updateCurrentTime();
}
lastLiveUpdateTime = now;
}
}
}
Expand Down