-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove MediaSourceContentInitializer, add CoreInterface
This is a proof-of-concept where I try to put in common the "content initialization" logic for our "multithread" mode and our monothreaded mode. The idea is to replace that mode-specific code to a very thin layer (here called `CoreInterface`) between our "init" code (always running in main thread) and our "core" code (in a WebWorker in "multithread" mode) which would handle both modes: - in multithreaded mode, it would be the part doing `postmessage` calls and `onmessage` registering for thread communication - in monothreaded mode, it would just do the same thing through a very simple EventEmitter-like approach Or written another way: "multithread" and single-threaded mode would now share the same logic beside the communication system used at the frontier between the main-thread and potential worker (respectively `src/main_thread` code and `src/core` code). The end goal is to remove a lot of code, and to reduce the difference between the multithreaded and monothreaded logic, so our tests (integration, manual tests etc.) actually almost test the two in one go. There might be some performance lost due to steps we are now performing unnecessarily when in monothreaded mode (e.g. we serialize the Manifest structure even though it's not needed when a single thread is used, we create another PlaybackObserver on the core even though the main thread one could be re-used etc.). To see if that lead to a visible difference and if it does, it shouldn't be that hard to work-around.
- Loading branch information
1 parent
1e4ca54
commit 3db53f1
Showing
28 changed files
with
488 additions
and
1,645 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
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
import { formatError } from "../../../errors"; | ||
import type { ISentError } from "../../../multithread_types"; | ||
|
||
export function formatErrorForSender(error: unknown): ISentError { | ||
const formattedError = formatError(error, { | ||
defaultCode: "NONE", | ||
defaultReason: "An unknown error stopped content playback.", | ||
}); | ||
|
||
return formattedError.serialize(); | ||
} |
Oops, something went wrong.