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

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

Issue 2529853002: Fix shutdown crash in AudioOutputAuthorizationHandler. (Closed)
Patch Set: . 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.cc
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc
index 4d1511f3f6cc0339bc3072c6e1a91561aa7e7ef7..98e931b295c9007e5e6bd6365320647bbfca16bc 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.cc
+++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -44,15 +44,6 @@ namespace {
base::LazyInstance<media::AudioStreamsTracker> g_audio_streams_tracker =
LAZY_INSTANCE_INITIALIZER;
-std::pair<int, std::pair<bool, std::string>> MakeAuthorizationData(
- int stream_id,
- bool authorized,
- const std::string& device_unique_id) {
- return std::make_pair(stream_id,
- std::make_pair(authorized, device_unique_id));
-}
-
-
void NotifyRenderProcessHostThatAudioStateChanged(int render_process_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -199,7 +190,10 @@ AudioRendererHost::AudioRendererHost(int render_process_id,
salt_(salt),
validate_render_frame_id_function_(&ValidateRenderFrameId),
max_simultaneous_streams_(0),
- authorization_handler_(media_stream_manager, render_process_id_, salt) {
+ authorization_handler_(audio_manager_,
+ media_stream_manager,
+ render_process_id_,
+ salt) {
DCHECK(audio_manager_);
}
@@ -387,7 +381,10 @@ void AudioRendererHost::OnRequestDeviceAuthorization(
<< ", security_origin=" << security_origin << ")";
if (LookupById(stream_id) || IsAuthorizationStarted(stream_id))
return;
- authorizations_.insert(MakeAuthorizationData(stream_id, false, device_id));
+
+ authorizations_.insert(
+ std::make_pair(stream_id, std::make_pair(false, std::string())));
+
// Unretained is ok here since |this| owns |authorization_handler_| and
// |authorization_handler_| owns the callback.
authorization_handler_.RequestDeviceAuthorization(

Powered by Google App Engine
This is Rietveld 408576698