| Index: media/audio/audio_device_thread.cc
|
| diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc
|
| index 0a0d274a00d48d72f38eefbd9e8032e3ca3873d8..c1f266baecd933fdec8019ff61c34c6a2fcba9c6 100644
|
| --- a/media/audio/audio_device_thread.cc
|
| +++ b/media/audio/audio_device_thread.cc
|
| @@ -6,7 +6,9 @@
|
|
|
| #include <limits>
|
|
|
| +#include "base/bind.h"
|
| #include "base/logging.h"
|
| +#include "base/threading/thread.h"
|
|
|
| namespace media {
|
|
|
| @@ -46,21 +48,27 @@ void AudioDeviceThread::Callback::InitializeOnAudioThread() {
|
| AudioDeviceThread::AudioDeviceThread(Callback* callback,
|
| base::SyncSocket::Handle socket,
|
| const char* thread_name)
|
| - : callback_(callback), thread_name_(thread_name), socket_(socket) {
|
| - CHECK(base::PlatformThread::CreateWithPriority(
|
| - 0, this, &thread_handle_, base::ThreadPriority::REALTIME_AUDIO));
|
| - DCHECK(!thread_handle_.is_null());
|
| + : callback_(callback),
|
| + socket_(socket),
|
| + thread_(new base::Thread("AudioDevice")) {
|
| + base::Thread::Options options;
|
| + options.joinable = true;
|
| + options.priority = base::ThreadPriority::REALTIME_AUDIO;
|
| + thread_->StartWithOptions(options);
|
| + bool started = thread_->WaitUntilThreadStarted();
|
| + CHECK(started);
|
| +
|
| + thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&AudioDeviceThread::ThreadMain, base::Unretained(this)));
|
| }
|
|
|
| AudioDeviceThread::~AudioDeviceThread() {
|
| socket_.Shutdown();
|
| - if (thread_handle_.is_null())
|
| - return;
|
| - base::PlatformThread::Join(thread_handle_);
|
| + thread_->Stop();
|
| }
|
|
|
| void AudioDeviceThread::ThreadMain() {
|
| - base::PlatformThread::SetName(thread_name_);
|
| callback_->InitializeOnAudioThread();
|
|
|
| uint32_t buffer_index = 0;
|
|
|