-
Notifications
You must be signed in to change notification settings - Fork 131
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
Release/v3.32.0 #1296
Merged
Merged
Release/v3.32.0 #1296
Conversation
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
Add `trackInfo` property to some `MediaError`
This commit adds the `declareInitSegment` and `freeInitSegment` methods to the RxPlayer's SegmentBuffer abstractions (which is the part of the code handling the operations on SourceBuffers, such as pushing media and init segments). The short term idea is to improve the handling of initialization segments in the SegmentBuffer. Until now, each pushed media segment lead to a check that the initialization segment it relies on is the same than the last one pushed. To be able to perform that check, a caller need to communicate again the initialization segment's data each time a chunk is pushed to the buffer. This check can be performed efficiently in most cases because we first check init segment's data equality by reference, which, by pure luck, should be equal in most cases in the current code. In cases where it isn't the same reference however, it can lead to a byte-per-byte check, which should not be an issue in terms of performance in most cases, but is still an ugly specificity which could be handled in a more optimal and understandable way. This commit now allows the definition of a `initSegmentUniqueId`, an identifier for initialization segments, on SegmentBuffers. Any pushed segments can then refer to its associated init segment by indicating which `initSegmentUniqueId` it is linked to. The SegmentBuffer will ensure behind the hood that the right initialization segment is pushed before pushing media segments, like before, excepted that this can now be done just by comparing this `initSegmentUniqueId` - it also means that the caller is no more required to keep in memory the data of the loaded initialization segment, the `SegmentBuffer` is already doing that. Previously, the initialization segment's data was kept by the `RepresentationStream`, the abstraction choosing which segments to load (which is part of the reasons why the reference mostly never changed). The declaration and "freeing" of init segment is done through a `declareInitSegment`/`freeInitSegment` pair of methods on a `SegmentBuffer`. This sadly means that memory freeing for the initialization segment is now manual, whereas we just relied on garbage collection when the initialization segment was directly used. --- Though mostly, the long term benefit is to implement the hybrid-worker mode that we plan to have in the future, where buffering is performed in a WebWorker (thus improving concurrence with an application, with the goal of preventing both UI stuttering due to heavy player tasks and rebuffering due to heavy UI tasks). In the currently-planned long term worker features we would have thus the following modes: - full worker: where both the rebuffering logic and MSE API are called in a WebWorker, allowing to avoid UI and media playback blocking each other to some extent This however requires the [MSE-in-Worker](w3c/media-source#175) feature to be available in the browser AND it also implies a more complex API, notably some callbacks (`manifestLoader`, `segmentLoader` and `representationFilter`) which will have to be updated. - hybrid mode: The buffering logic is mainly performed in a WebWorker but MSE API are still in the main thread. This allows e.g. to not fight for CPU with the UI to know which segments to download and to avoid blocking the UI when the Manifest is being parsed. Though the UI blocking could still mean that a loaded segment is waiting to be pushed in that mode. Because here MSE APIs may have to be called through `postMessage`-style message passing, the previous logic of communicating each time the same initialization segment each time a segment was pushed, with no mean to just move that data (in JavaScript linguo, to "transfer" it) was considerably worst than before. Relying on a short identifier instead seems a better solution here. - normal mode: The current mode where everything stays in main thread. However it should be noted that all of this long term objective is still in an higly experimental phase, and the gains are only theoretical for now.
This commit performs a small modifications so that the `Stream` module, when asking for the current content to be "reloaded" (that is: to replace its MediaSource, generally both for compatibility reasons and to ensure buffers are flushed), no longer needs to either calculate the position to reload to nor if it should auto-play after the reload. This is a simplification of a "reload" event from the point of view of the `Stream`. A "reload" there now is mostly done "in-place" (with a possible time offset to apply, e.g. to re-play the last second after changing the audio track, the `Stream` could be asking for a `timeOffset` of `-1`) and playback characteristics are mostly kept as they were before the reload. The position and playing status is now computed by the `MediaSourceContentInitializer`, which is the actual module doing the reloading logic, based on the position and playing status at the time the reload order was received. This is important in our current Proof-of-Concept of running the RxPlayer in a worker: Calculating the current position and playing status was in the end done synchronously by asking the `HTMLMediaElement` on the page. In a worker, we do not have access to the `HTMLMediaElement`, thus that data cannot be accessed synchronously if the module asking for it is running on the worker (and the `Stream` fully runs in the worker). By keeping such logic closer to the higher level of the RxPlayer's internal architecture (closer to the API, further from the core), we greatly facilitate the possibility of splitting that logic between main thread (`HTMLMediaElement` management) and worker (`Stream`, `MediaSource` management when MSE-in-worker is available). The `MediaSourceContentInitializer` itself is on that matter splitted into two parts: a part in the main thread, the other in the worker. Even if that Proof-of-Concept is not actually merged in the future, this small modification still makes sense, at least to me.
As we're going to probably remove it from the v4 (#1276), it makes sense to prepare its removal by first deprecating in the v3.
Merged
peaBerberian
force-pushed
the
release/v3.32.0
branch
from
October 2, 2023 13:27
f3285f5
to
cab3233
Compare
peaBerberian
force-pushed
the
release/v3.32.0
branch
2 times, most recently
from
October 13, 2023 09:30
50c6243
to
3bd7c72
Compare
[Proposal] Add `declareInitSegment` method to the SegmentBuffer abstraction
Decide the position and autoplay status of a Reload in the Initializer
Implement checking Dolby Atmos
Deprecate manifestUpdateUrl loadVideo option in the v3
The `StreamEventsEmitter` is the RxPlayer module storing events found in the Manifest (for now only DASH' `EventStream` elements) and emitting `streamEvent`/`streamEventSkip` RxPlayer events when they are encountered. In the WebWorker work (#1272), I had to refacto the `StreamEventsEmitter` from being a long-lived function to being a class, to make it possible to be communicated manifest updates less awkwardly and more idiomatically, through an `onManifestUpdate` method. However, I liked the result and find it much more easy to understand than the previous one, which bears the mark of having been previously an RxJS-based logic. This refacto the `StreamEventsEmitter` into a class without adding the supplementary worker-linked logic handlin manifest updates differently. Basically, it's just now a class emitting events with `start` and `stop` methods.
Bring multiple feature switching improvements
StreamEventsEmitter is now a class
In #1287, I deprecated the `NATIVE_TEXT_BUFFER` and `HTML_TEXT_BUFFER` as they already are automatically included when importing one of the corresponding text track parsers (so there's no point to have a separate import here, it can just be lazily added on any of those parser's injection to the RxPlayer). Yet I forgot that the exact same situation was there for the `IMAGE_BUFFER` (and even completely forgot to re-document image-related features). This is now done.
Deprecate image buffer feature
peaBerberian
force-pushed
the
release/v3.32.0
branch
from
October 13, 2023 09:48
3bd7c72
to
ba1abf8
Compare
peaBerberian
force-pushed
the
release/v3.32.0
branch
from
October 17, 2023 13:37
e9d4685
to
b0964d7
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release: v3.32.0
Branch for the incoming
3.32.0
release. We're in the process of testing it.Those last months focus has mainly shifted into:
MULTI_THREAD
feature relying on a WebWorker #1272) offered great preliminary results, encouraging us to start implementing it, now the implementations works "too well" for some cases, with the worker overwhelming the main thread (and worsening some perf issues) in some specific scenarios.Consequently this v3 release contains mainly a multitude of small-ish improvements backported when working on those.
The only "real" feature is the new
isSpatialAudio
property on audio Representations, a nice signalization improvement brought to us by @klatoszewski-oke.Changelog
Features
isSpatialAudio
boolean property to Representation returned bygetAvailableAudioTracks
,getAudioTrack
, corresponding events, andtrackInfo
optional property ofMediaError
objects to signal Dolby Atmos techology [Implement checking Dolby Atmos #1275]LOCAL
: addisSpatialAudio
property to Representation of the experiment"local"
transport (used for offline playback) [Implement checking Dolby Atmos #1275]addFeatures
static method is now available on all RxPlayer builds. It was previously only in the minimal (rx-player/minimal
import path) [Bring multiple feature switching improvements #1287]NATIVE_TEXT_BUFFER
,HTML_TEXT_BUFFER
andIMAGE_BUFFER
features are now totally optional [Bring multiple feature switching improvements #1287, Deprecate image buffer feature #1293]Bug fixes
setVideoBitrate
andsetAudioBitrate
API which may have led to a higher quality than wanted in the default"seamless"
manualBitrateSwitchingMode
if our buffer-based adaptive logic decided to [DASH_WASM: Update quick-xml (Rust) dependency and consequently update Rust code #1267, Provide better fix for the set{Video,Audio}Bitrate issue #1271]"LOADED"
state once the HTMLMediaElement'sreadyState
of4
has been reached, as it seems to switch to3
too soon there [PS5: wait for a readyState of4
before considering the content loaded #1257]AdaptationSet
have anadaptation-set-switching
<SupplementalProperty>
between one another [DASH: Fix track duplication when merging more than one switchable AdaptationSet #1279]Other improvements
NetworkError
messages [Implement better messages for request errors #1274]keySystems
option is set when playing an encrypted contentDeprecated
manifestUpdateUrl
loadVideo
option as it doesn't seem used anymore [Deprecate manifestUpdateUrl loadVideo option in the v3 #1288]NATIVE_TEXT_BUFFER
,HTML_TEXT_BUFFER
andIMAGE_BUFFER
features as they are now unneeded [Bring multiple feature switching improvements #1287, Deprecate image buffer feature #1293]