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

Support WebAudio #4577

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Support WebAudio #4577

wants to merge 6 commits into from

Conversation

sideb0ard
Copy link
Contributor

@sideb0ard sideb0ard commented Dec 13, 2024

Implement SbAudioSink based WebAudioDevice.

b/340599896

Tested on a Kirkwood device by running:
https://github.com/youtube/cobalt/tree/25.lts.1%2B/cobalt/demos/content/web-audio-demo
and
https://webaudiodemos.appspot.com/oscilloscope/index.html

@sideb0ard sideb0ard requested a review from a team as a code owner December 13, 2024 20:12
@sideb0ard sideb0ard marked this pull request as draft December 18, 2024 23:15
@xiaomings xiaomings self-requested a review December 23, 2024 23:39
@sideb0ard sideb0ard changed the title WIP Support WebAudio Dec 24, 2024
@sideb0ard sideb0ard marked this pull request as ready for review December 30, 2024 21:52
@sideb0ard sideb0ard requested a review from a team as a code owner December 30, 2024 21:52
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 open comments, lgtm

@@ -191,7 +191,13 @@ void CreateRendererTestService(

} // namespace

ShellContentRendererClient::ShellContentRendererClient() {}
ShellContentRendererClient::ShellContentRendererClient() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm we should avoid modifying //content, and in any case wouldn't this only work for linux-like platforms? (I.e. not for Android TV). In any case, we could add a ContentRendererClient in //cobalt much like the others: https://source.chromium.org/search?q=%22public%20content::ContentRendererClient%22%20-test&ss=chromium%2Fchromium%2Fsrc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, thank you! CobaltContentRendererClient added in #4661
I'll wait for that to get merged, then rebase here.

Copy link
Contributor Author

@sideb0ard sideb0ard Jan 9, 2025

Choose a reason for hiding this comment

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

now moved to impl in CobaltContentRendererClient.

in any case wouldn't this only work for linux-like platforms? (I.e. not for Android TV).

why would this not work for Android? I've been testing on Android.

OutputDeviceInfo StarboardAudioDeviceFactory::GetOutputDeviceInfo(
const blink::LocalFrameToken& frame_token,
const std::string& device_id) {
LOG(ERROR) << "GetOutputDeviceInfo - NOT IMPL";
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider to add NOTIMPLEMENTED() if this is intended.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for all other not implemented places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

namespace media {

class MEDIA_EXPORT StarboardAudioDeviceFactory final
: public blink::AudioDeviceFactory {
Copy link
Contributor

Choose a reason for hiding this comment

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

AsAudioDeviceFactory is the class belong to blink, we may consider to move starboard_audio_device_factory.{cc.h} to //cobalt, instead of putting them under //media.

Examples like CastAudioDeviceFactory is under //chromecast.
https://source.chromium.org/chromium/chromium/src/+/main:chromecast/media/audio/cast_audio_device_factory.h;l=22

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we leave it named StarboardAudioDeviceFactory or should i rename it CobaltAudioDeviceFactory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, moved and renamed.

#include "media/starboard/starboard_audio_renderer_sink.h"

#include "base/logging.h"

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove new line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

#include "starboard/audio_sink.h"

#include "base/synchronization/lock.h"

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove new line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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