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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2578983003: Add AudioStreamRegistry. Move stream counting logic (Closed)
Patch Set: Add missing EXPECT_TRUE. Created 4 years 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/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 6b7b72e7c49dfff21aff9563cb85652a2926a20a..09422875e0addd1bd5a6e6ac3c8248ab5efd181d 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -102,6 +102,7 @@
#include "content/browser/renderer_host/file_utilities_message_filter.h"
#include "content/browser/renderer_host/media/audio_input_renderer_host.h"
#include "content/browser/renderer_host/media/audio_renderer_host.h"
+#include "content/browser/renderer_host/media/audio_stream_registry_impl.h"
#include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
#include "content/browser/renderer_host/media/peer_connection_tracker_host.h"
#include "content/browser/renderer_host/media/video_capture_host.h"
@@ -680,6 +681,7 @@ RenderProcessHostImpl::RenderProcessHostImpl(
gpu_observer_registered_(false),
delayed_cleanup_needed_(false),
within_process_died_observer_(false),
+ audio_stream_registry_(AudioStreamRegistryImpl::Create(id_)),
#if BUILDFLAG(ENABLE_WEBRTC)
webrtc_eventlog_host_(id_),
#endif
@@ -1072,8 +1074,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
BrowserMainLoop::GetInstance()->user_input_monitor());
AddFilter(audio_input_renderer_host_.get());
audio_renderer_host_ = new AudioRendererHost(
- GetID(), audio_manager, AudioMirroringManager::GetInstance(),
- media_stream_manager,
+ GetID(), audio_stream_registry_.get(), audio_manager,
+ AudioMirroringManager::GetInstance(), media_stream_manager,
browser_context->GetResourceContext()->GetMediaDeviceIDSalt());
AddFilter(audio_renderer_host_.get());
AddFilter(
@@ -2267,6 +2269,16 @@ void RenderProcessHostImpl::EnableAudioDebugRecordings(
base::Bind(&AudioInputRendererHost::EnableDebugRecording,
audio_input_renderer_host_, file));
}
+
+ if (audio_stream_registry_) {
o1ka 2016/12/22 10:46:52 We should not have two approaches side by side, sh
Max Morin 2017/01/09 15:34:23 Right, null check is not actually necessary.
+ // |audio_stream_registry_| is deleted on the IO thread and if |this| is
+ // alive now it means that the task to delete |audio_stream_registry_|
o1ka 2016/12/22 10:46:52 Could you clarify in the comment how one follows f
Max Morin 2017/01/09 15:34:23 Done.
+ // isn't posted yet, so unretained is safe.
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&AudioStreamRegistryImpl::EnableDebugRecording,
+ base::Unretained(audio_stream_registry_.get()), file));
+ }
}
void RenderProcessHostImpl::DisableAudioDebugRecordings() {
@@ -2780,7 +2792,7 @@ void RenderProcessHostImpl::UpdateProcessPriority() {
// visible widgets -- the callers must call this function whenever we
// transition in/out of those states.
const bool should_background =
- visible_widgets_ == 0 && !audio_renderer_host_->HasActiveAudio() &&
+ visible_widgets_ == 0 && !audio_stream_registry_->HasActiveAudio() &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableRendererBackgrounding);

Powered by Google App Engine
This is Rietveld 408576698