Skip to content

Commit

Permalink
Bug 1928798 - do not return fatal error if the initialization failed,…
Browse files Browse the repository at this point in the history
… try again with another state machine. r=jrmuizel, a=RyanVM

It's possible that the initialization failure is caused by the user's
device not supporting the media engine pipeline. In this case, we
should attempt to use another state machine for playback instead of
simply returning an error.

Differential Revision: https://phabricator.services.mozilla.com/D227773
  • Loading branch information
alastor0325 committed Nov 2, 2024
1 parent 39c9090 commit 52730c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dom/media/ExternalEngineStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,12 @@ void ExternalEngineStateMachine::OnEngineInitFailure() {
auto* state = mState.AsInitEngine();
state->mEngineInitRequest.Complete();
state->mInitPromise = nullptr;
// TODO : Should fallback to the normal playback with media engine.
ReportTelemetry(NS_ERROR_DOM_MEDIA_FATAL_ERR);
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__));
// Even if we failed to initialize the media engine, we still want to try
// again with the normal state machine, so don't return a fatal error, return
// NS_ERROR_DOM_MEDIA_EXTERNAL_ENGINE_NOT_SUPPORTED_ERR instead.
ReportTelemetry(NS_ERROR_DOM_MEDIA_MEDIA_ENGINE_INITIALIZATION_ERR);
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_EXTERNAL_ENGINE_NOT_SUPPORTED_ERR,
__func__));
}

void ExternalEngineStateMachine::ReadMetadata() {
Expand Down
1 change: 1 addition & 0 deletions xpcom/base/ErrorList.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ def SUCCESS(code):
errors["NS_ERROR_DOM_MEDIA_DENIED_IN_NON_UTILITY"] = FAILURE(104)
errors["NS_ERROR_DOM_MEDIA_RANGE_ERR"] = FAILURE(105)
errors["NS_ERROR_DOM_MEDIA_TYPE_ERR"] = FAILURE(106)
errors["NS_ERROR_DOM_MEDIA_MEDIA_ENGINE_INITIALIZATION_ERR"] = FAILURE(107)

# =======================================================================
# 42: NS_ERROR_MODULE_URL_CLASSIFIER
Expand Down

0 comments on commit 52730c4

Please sign in to comment.