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

Feature/change type config flag #4069

Merged
merged 2 commits into from
Oct 18, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ declare namespace dashjs {
useAppendWindow?: boolean,
setStallState?: boolean
avoidCurrentTimeRangePruning?: boolean
useChangeTypeForTrackSwitch?: boolean
},
gaps?: {
jumpGaps?: boolean,
Expand Down
13 changes: 9 additions & 4 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ import Events from './events/Events';
* stallThreshold: 0.5,
* useAppendWindow: true,
* setStallState: true,
* avoidCurrentTimeRangePruning: false
* avoidCurrentTimeRangePruning: false,
* useChangeTypeForTrackSwitch: true
* },
* gaps: {
* jumpGaps: true,
Expand Down Expand Up @@ -309,6 +310,9 @@ import Events from './events/Events';
* Avoids pruning of the buffered range that contains the current playback time.
*
* That buffered range is likely to have been enqueued for playback. Pruning it causes a flush and reenqueue in WPE and WebKitGTK based browsers. This stresses the video decoder and can cause stuttering on embedded platforms.
* @property {boolean} [useChangeTypeForTrackSwitch=true]
* If this flag is set to true then dash.js will use the MSE v.2 API call "changeType()" before switching to a different track.
* Note that some platforms might not implement the changeType functio. dash.js is checking for the availability before trying to call it.
*/

/**
Expand Down Expand Up @@ -463,11 +467,11 @@ import Events from './events/Events';
* In low latency mode, when measured latency is higher/lower than the target one, dash.js increases/decreases playback rate respectively up to (+/-) the percentage defined with this method until target is reached.
*
* Valid values for min catch up rate are in the range -0.5 to 0 (-50% to 0% playback rate decrease)
*
*
* Valid values for max catch up rate are in the range 0 to 1 (0% to 100% playback rate increase).
*
* Set min and max to NaN to turn off live catch up feature.
*
*
* These playback rate limits take precedence over any PlaybackRate values in ServiceDescription elements in an MPD. If only one of the min/max properties is given a value, the property without a value will not fall back to a ServiceDescription value. Its default value of NaN will be used.
*
* Note: Catch-up mechanism is only applied when playing low latency live streams.
Expand Down Expand Up @@ -813,7 +817,8 @@ function Settings() {
stallThreshold: 0.3,
useAppendWindow: true,
setStallState: true,
avoidCurrentTimeRangePruning: false
avoidCurrentTimeRangePruning: false,
useChangeTypeForTrackSwitch: true
},
gaps: {
jumpGaps: true,
Expand Down
12 changes: 10 additions & 2 deletions src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ function BufferController(config) {
return updateAppendWindow();
})
.then(() => {
return sourceBufferSink.changeType(codec);
if (settings.get().streaming.buffer.useChangeTypeForTrackSwitch) {
return sourceBufferSink.changeType(codec);
}

return Promise.resolve();
})
.then(() => {
return pruneAllSafely();
Expand Down Expand Up @@ -443,7 +447,11 @@ function BufferController(config) {
return new Promise((resolve, reject) => {
updateAppendWindow()
.then(() => {
return sourceBufferSink.changeType(codec);
if (settings.get().streaming.buffer.useChangeTypeForTrackSwitch) {
return sourceBufferSink.changeType(codec);
}

return Promise.resolve();
})
.then(() => {
resolve();
Expand Down