diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-20 05:05:52 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-20 05:05:52 +0000 |
commit | 45e9b983ddfec5f35a10c3280c67b86dcb1b796c (patch) | |
tree | e838957bbf8a6fb2b7a9e59e0c451a44dc353d9e /remoting | |
parent | 3391f3f878ba5ce0161a8cb875bbab396f0cc7b5 (diff) | |
download | chromium_src-45e9b983ddfec5f35a10c3280c67b86dcb1b796c.zip chromium_src-45e9b983ddfec5f35a10c3280c67b86dcb1b796c.tar.gz chromium_src-45e9b983ddfec5f35a10c3280c67b86dcb1b796c.tar.bz2 |
Tear down AudioPipeReader on host shutdown, to release audio thread.
The AudioPipeReader holds a reference to the audio thread, which
causes it and the host process main thread to remain in-use even
after the host has shutdown, preventing the process from exiting.
This CL works around the problem by releasing the global object
when the host shutdown completes; in future the AudioPipeReader
reference will be moved into the DesktopEnvironmentFactory.
BUG=161373
Review URL: https://chromiumcodereview.appspot.com/11280048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/audio_capturer_linux.cc | 9 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/remoting/host/audio_capturer_linux.cc b/remoting/host/audio_capturer_linux.cc index 0ad38a6..d8cb548 100644 --- a/remoting/host/audio_capturer_linux.cc +++ b/remoting/host/audio_capturer_linux.cc @@ -22,11 +22,16 @@ base::LazyInstance<scoped_refptr<AudioPipeReader> >::Leaky } // namespace +// TODO(wez): Remove this and have the DesktopEnvironmentFactory own the +// AudioPipeReader rather than having it process-global. +// See crbug.com/161373 and crbug.com/104544. void AudioCapturerLinux::InitializePipeReader( scoped_refptr<base::SingleThreadTaskRunner> task_runner, const FilePath& pipe_name) { - g_pulseaudio_pipe_sink_reader.Get() = - AudioPipeReader::Create(task_runner, pipe_name); + scoped_refptr<AudioPipeReader> pipe_reader; + if (!pipe_name.empty()) + pipe_reader = AudioPipeReader::Create(task_runner, pipe_name); + g_pulseaudio_pipe_sink_reader.Get() = pipe_reader; } AudioCapturerLinux::AudioCapturerLinux( diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 01ff3bb..1672317 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -611,6 +611,14 @@ void HostProcess::ShutdownOnUiThread() { // It is now safe for the HostProcess to be deleted. self_ = NULL; + +#if defined(OS_LINUX) + // Cause the global AudioPipeReader to be freed, otherwise the audio + // thread will remain in-use and prevent the process from exiting. + // TODO(wez): DesktopEnvironmentFactory should own the pipe reader. + // See crbug.com/161373 and crbug.com/104544. + AudioCapturerLinux::InitializePipeReader(NULL, FilePath()); +#endif } // Overridden from HeartbeatSender::Listener |