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

[media] Report errors via MediaError to WebApp #4453

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

borongc
Copy link
Contributor

@borongc borongc commented Nov 19, 2024

This PR adds StarboardRendererFactory, which contains media_log_ to StarboardRenderer, and is necessary for error reporting.

Chromium uses both RendererClient::OnError and media_log_ to report error code and message to MediaError. As a result, Cobalt adapts it from C25 to report error messages to WebApp.

b/375271948
b/375278384

@borongc
Copy link
Contributor Author

borongc commented Nov 19, 2024

Note that part of implementation of StarboardRendererFactory is taken from #4407.

Copy link
Contributor

@yell0wd0g yell0wd0g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good.

content/renderer/media/media_factory.cc Outdated Show resolved Hide resolved
@@ -68501,6 +68501,8 @@ Called by update_use_counter_css.py.-->
<int value="9" label="kCastStreaming"/>
<int value="10" label="kContentEmbedderDefined"/>
<int value="11" label="kTest"/>
<!-- Cobalt: Renderer for Starboard (SbPlayer) -->
<int value="12" label="kStarboard"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

media/mojo/mojom/BUILD.gn Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated but I'd change l.15

assert(is_cobalt, "This file builds for cobalt builds, not Chromium builds")

with

assert(is_starboard_media)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding with a previous chat with Borong is this file may compile when use_starboard_media = false in the future : we want to compare cobalt with starboard media, cobalt without starboard media on android. I'll leave it to Borong to add the assert if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BUILD.gn file is built when is_cobalt=true. StarboardRenderer is a subcomponent for //media (

media_subcomponent_deps += [ "//media/starboard" ]
), unless we change it to use_starboard_media, it is right here.

client_->OnError(PIPELINE_ERROR_DECODE);
break;
case kSbPlayerErrorMax:
NOTREACHED();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this kSbPlayerErrorMax ever appear?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so.

LOG(ERROR) << "StarboardRenderer::OnPlayerError() called with code " << error
<< " and message \"" << message << "\"";
NOTIMPLEMENTED();
switch (error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a fallback for other cases not specified now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For SbPlayer, we only have kSbPlayerErrorDecode and kSbPlayerErrorCapabilityChanged for errors. It should be fine here for not specifying a default case.

media/starboard/starboard_renderer.h Outdated Show resolved Hide resolved
@@ -2838,6 +2823,14 @@ std::unique_ptr<media::Renderer> WebMediaPlayerImpl::CreateRenderer(
media_metrics_provider_->SetRendererType(renderer_type_);
media_log_->SetProperty<MediaLogProperty::kRendererName>(renderer_type_);

#if BUILDFLAG(USE_STARBOARD_MEDIA)
LOG(INFO) << "Renderer Type is " << GetRendererName(renderer_type_) << ".";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already logged in Media DevTools in l.2824, is this extra LOG() needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may not always use DevTools for media. This can ensure we can have this in adb bugreport.

@yell0wd0g
Copy link
Contributor

@niranjanyardi @andrewsavage1 for the questions on GN files.

Copy link
Contributor

@niranjanyardi niranjanyardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the open comments lgtm from a build perspective.

This PR adds `StarboardRendererFactory`, which contains `media_log_` to `StarboardRenderer`.

Chromium uses both `RendererClient::OnError` and `media_log_` to report error code and message to MediaError. As a result, Cobalt adapts it from C25 to report error messages to WebApp.

b/375271948
b/375278384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants