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

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

Issue 2424163004: Factor out authorization from AudioRendererHost. (Closed)
Patch Set: const& Created 4 years, 1 month 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 63d4fe7a8247f32cb05e37754a7600f359255492..2fa7d353ae2b9445b1c137f46c4e0eef2a7f136d 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 {
@@ -101,6 +103,8 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
// be called from any thread.
bool HasActiveAudio();
+ void OverrideDevicePermissionsForTesting(bool has_access);
+
private:
friend class AudioRendererHostTest;
friend class BrowserThread;
@@ -145,6 +149,14 @@ class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter {
const std::string& device_id,
const url::Origin& security_origin);
+ void AuthorizationCompleted(int stream_id,
+ const url::Origin& security_origin,
+ base::TimeTicks auth_start_time,
+ media::OutputDeviceStatus status,
+ bool should_send_id,
+ const media::AudioParameters& params,
+ const std::string& raw_device_id);
+
// Creates an audio output stream with the specified format.
// Upon success/failure, the peer is notified via the NotifyStreamCreated
// message.
@@ -199,39 +211,6 @@ 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(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);
@@ -250,9 +229,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_;
@@ -278,6 +254,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