-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add config to allow reset MSE on cross boundary (#8156)
There's devices out there that are not compliant with the MSE spec. Such as halting MSE when a secondary init segment is appended (webOS 3), or failing to transition from a plain to encrypted init segment (Tizen 2017). While we initially prefer content workarounds, it's a time consuming and trial & error process. For some devices it might not be worth investing time into finding a proper workaround due to low usage. We're giving people an alternative by resetting MSE when needed (configurable). dash.js offers somewhat similar behavior [here](https://github.com/Dash-Industry-Forum/dash.js/blob/a656ec709e7f92f76b392bf196ee9883da7928ce/src/streaming/controllers/StreamController.js#L672), where MSE is reset before applying an encrypted init segment. This PR introduces `crossBoundaryStrategy` in `StreamingConfiguration`. It can be configured as following: - KEEP - we're keeping MSE active, this is the default and the current behavior. - RESET - we'll always reset MSE when it crosses a boundary. - RESET_TO_ENCRYPTED - we reset MSE when it crosses an encrypted boundary, and we keep MSE afterwards. Additionally, we're not going to reset when we're crossing a plain to plain boundary. Each initSegmentReference now holds an `encrypted` and `boundaryEnd` value. When configured with a different value than KEEP, `StreamingEngine` will be instructed to fetch and append segment references up until the boundary of the currently applied init segment. We detect whether we're at a boundary in a few ways: - Listening to the HTML5 MediaElement's `waiting` event, this'll indicate that we do not have enough buffer to advance. If we're pretty close to the boundary, we assume we're at the boundary. - Due to subtle differences in the segment alignments, waiting wasn't reliable. When close to a boundary, a timer is fired with the assumption that "we'll reach the boundary at soon". I've set the threshold to 1 second, when playhead is further than the threshold, we'll skip checking whether an MSE reset is due. The implementation relies on the added properties in the init segment reference, and the concept of a "Period" is avoided in StreamingEngine to ensure it's compatible with HLS too. --------- Co-authored-by: Álvaro Velad Galván <[email protected]> Co-authored-by: Wojciech Tyczyński <[email protected]>
- Loading branch information
1 parent
b8519f1
commit 3699164
Showing
18 changed files
with
408 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ Dave Nicholas <[email protected]> | |
David Pfister <[email protected]> | ||
Davide Zordan <[email protected]> | ||
Dl Dador <[email protected]> | ||
DPG Media <*@dpgmedia.be> | ||
Edgeware AB <*@edgeware.tv> | ||
Enson Choy <[email protected]> | ||
Esteban Dosztal <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*! @license | ||
* Shaka Player | ||
* Copyright 2016 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
goog.provide('shaka.config.CrossBoundaryStrategy'); | ||
|
||
/** | ||
* @enum {string} | ||
* @export | ||
*/ | ||
shaka.config.CrossBoundaryStrategy = { | ||
/** | ||
* Never reset MediaSource when crossing boundary. | ||
*/ | ||
'KEEP': 'keep', | ||
/** | ||
* Always reset MediaSource when crossing boundary. | ||
*/ | ||
'RESET': 'reset', | ||
/** | ||
* Reset MediaSource once, when transitioning from a plain | ||
* boundary to an encrypted boundary. | ||
*/ | ||
'RESET_TO_ENCRYPTED': 'reset_to_encrypted', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.