Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1450)

Unified Diff: content/browser/renderer_host/media/audio_renderer_host.h

Issue 2424163004: Factor out authorization from AudioRendererHost. (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_renderer_host.h
diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h
index afdb31b2b2ab6889a8200f562b056271e6af7ad3..984081f02f1c70256830598b59d70048c3560681 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.h
+++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -54,6 +54,7 @@
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
#include "base/sequenced_task_runner_helpers.h"
+#include "content/browser/renderer_host/media/audio_output_authorization_handler.h"
#include "content/browser/renderer_host/media/media_devices_manager.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_message_filter.h"
@@ -64,6 +65,7 @@
#include "media/audio/audio_logging.h"
#include "media/audio/audio_output_controller.h"
#include "media/audio/simple_sources.h"
+#include "media/base/output_device_info.h"
#include "url/origin.h"
namespace media {
@@ -76,8 +78,6 @@ namespace content {
class AudioMirroringManager;
class MediaInternals;
class MediaStreamManager;
-class MediaStreamUIProxy;
-class ResourceContext;
class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
public:
@@ -147,6 +147,12 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
const std::string& device_id,
const url::Origin& security_origin);
+ void AuthorizationCompleted(int stream_id,
+ base::TimeTicks auth_start_time,
+ media::OutputDeviceStatus status,
+ const media::AudioParameters& params,
+ const std::string& unique_id);
+
// Creates an audio output stream with the specified format.
// Upon success/failure, the peer is notified via the NotifyStreamCreated
// message.
@@ -201,44 +207,12 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// ResourceScheduler when the renderer starts or stops playing an audiostream.
void UpdateNumPlayingStreams(AudioEntry* entry, bool is_playing);
- // Check if the renderer process has access to the requested output device.
- void CheckOutputDeviceAccess(int render_frame_id,
- const std::string& device_id,
- const url::Origin& security_origin,
- int stream_id,
- base::TimeTicks auth_start_time);
-
- // Proceed with device authorization after checking permissions.
- void AccessChecked(std::unique_ptr<MediaStreamUIProxy> ui_proxy,
- const std::string& device_id,
- const url::Origin& security_origin,
- int stream_id,
- base::TimeTicks auth_start_time,
- bool have_access);
-
- // Translate the hashed |device_id| to a unique device ID.
- void TranslateDeviceID(const std::string& device_id,
- const url::Origin& security_origin,
- int stream_id,
- base::TimeTicks auth_start_time,
- const MediaDeviceEnumeration& enumeration);
-
- // Get audio hardware parameters on the device thread.
- media::AudioParameters GetDeviceParametersOnDeviceThread(
- const std::string& device_id);
-
- // Proceed with device authorization after translating device ID and
- // receiving hardware parameters.
- void DeviceParametersReceived(int stream_id,
- base::TimeTicks auth_start_time,
- bool device_found,
- const std::string& unique_id,
- const media::AudioParameters& output_params);
-
// Helper method to check if the authorization procedure for stream
// |stream_id| has started.
bool IsAuthorizationStarted(int stream_id);
+ void OnBadMessage(content::bad_message::BadMessageReason reason);
+
// Called from AudioRendererHostTest to override the function that checks for
// the existence of the RenderFrameHost at stream creation time.
void set_render_frame_id_validate_function_for_testing(
@@ -253,9 +227,6 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
AudioMirroringManager* const mirroring_manager_;
std::unique_ptr<media::AudioLog> audio_log_;
- // Used to access to AudioInputDeviceManager.
- MediaStreamManager* media_stream_manager_;
-
// A map of stream IDs to audio sources.
AudioEntryMap audio_entries_;
@@ -263,9 +234,6 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// thread, but should only be updated from the IO thread.
base::AtomicRefCount num_playing_streams_;
- // Salt required to translate renderer device IDs to raw device unique IDs
- std::string salt_;
-
// Map of device authorizations for streams that are not yet created
// The key is the stream ID, and the value is a pair. The pair's first element
// is a bool that is true if the authorization process completes successfully.
@@ -281,6 +249,8 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// host. Reported as UMA stat at shutdown.
size_t max_simultaneous_streams_;
+ AudioOutputAuthorizationHandler authorization_handler_;
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
};

Powered by Google App Engine
This is Rietveld 408576698