Audio service stream factory client in content/.
Stuff of note:
- Code is for the UI thread. All the state we care about (permissions, frame/WebContents events,
UI indicators, ...) is on the UI thread, and there are some tricky ordering problems with
having the code on the IO thread if we want to observe frames/wc. As a bonus, we can
get rid of a bunch of code posting to the UI thread in permissions and monitoring code.
- In order to not need helper WebContentsObservers that proxies to the
ContentAudioStreamFactoryClient, we have one ContentAudioStreamFactoryClient per WebContents.
This also simplifies keeping the group id for the WebContents (just instantiate it in the
constructor.
- State is put in AudioOutputStreamBroker (and AudioInputStreamBroker, LoopbackStreamBroker, ...).
We can have super simple per-frame factories thread that just checks permissions and forwards
the request to the FactoryClient.
- AudioOutputController errors are sent to content/ through the AudioOutputStreamObserver
interface, so that it knows if we had a real error, service crash, or the client terminated the
stream peacefully. content/ then forwards the error to the client. This also eliminates the
AudioOutputStreamClient interface, simplifying a bit. This is done in the dependency CL.
Next up, a RendererAudioOutputStreamFactory implementation (living in RenderFrameHost) which
propagates requests to the ForwardingStreamFactory will be added.
Class diagram involving some of these things:
https://docs.google.com/drawings/d/1_ZIKj6lihGKRjq4Mflduitmkn_REqpHFeqVNelBGHHk/edit
Bug: 830493
Change-Id: I7e3804fa4a6ec6de8a2d0a971ecd5be69d267b1c
Reviewed-on: https://chromium-review.googlesource.com/982058
Reviewed-by: Camille Lamy <[email protected]>
Reviewed-by: Tommi <[email protected]>
Reviewed-by: Yuri Wiitala <[email protected]>
Reviewed-by: Olga Sharonova <[email protected]>
Commit-Queue: Max Morin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#555331}
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 8d23ab5..22c7fd3 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -117,7 +117,7 @@
"//printing/buildflags",
"//services/audio:lib",
"//services/audio/public/cpp",
- "//services/audio/public/mojom:constants",
+ "//services/audio/public/mojom",
"//services/catalog:constants",
"//services/catalog/public/cpp",
"//services/catalog/public/mojom:constants",
@@ -1050,6 +1050,10 @@
"media/android/media_web_contents_observer_android.h",
"media/audible_metrics.cc",
"media/audible_metrics.h",
+ "media/audio_output_stream_broker.cc",
+ "media/audio_output_stream_broker.h",
+ "media/audio_stream_broker.cc",
+ "media/audio_stream_broker.h",
"media/audio_stream_monitor.cc",
"media/audio_stream_monitor.h",
"media/capture/audio_mirroring_manager.cc",
@@ -1066,6 +1070,8 @@
"media/cdm_registry_impl.h",
"media/flinging_renderer.cc",
"media/flinging_renderer.h",
+ "media/forwarding_audio_stream_factory.cc",
+ "media/forwarding_audio_stream_factory.h",
"media/media_devices_permission_checker.cc",
"media/media_devices_permission_checker.h",
"media/media_devices_util.cc",