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

Side by Side Diff: media/audio/clockless_audio_sink.cc

Issue 2023343002: Migrate WaitableEvent to enum-based constructor in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/scoped_task_runner_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/clockless_audio_sink.h" 5 #include "media/audio/clockless_audio_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
11 #include "media/base/audio_hash.h" 11 #include "media/base/audio_hash.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // Internal to ClocklessAudioSink. Class is used to call Render() on a seperate 15 // Internal to ClocklessAudioSink. Class is used to call Render() on a seperate
16 // thread, running as fast as it can read the data. 16 // thread, running as fast as it can read the data.
17 class ClocklessAudioSinkThread : public base::DelegateSimpleThread::Delegate { 17 class ClocklessAudioSinkThread : public base::DelegateSimpleThread::Delegate {
18 public: 18 public:
19 ClocklessAudioSinkThread(const AudioParameters& params, 19 ClocklessAudioSinkThread(const AudioParameters& params,
20 AudioRendererSink::RenderCallback* callback, 20 AudioRendererSink::RenderCallback* callback,
21 bool hashing) 21 bool hashing)
22 : callback_(callback), 22 : callback_(callback),
23 audio_bus_(AudioBus::Create(params)), 23 audio_bus_(AudioBus::Create(params)),
24 stop_event_(new base::WaitableEvent(false, false)) { 24 stop_event_(new base::WaitableEvent(
25 base::WaitableEvent::ResetPolicy::AUTOMATIC,
26 base::WaitableEvent::InitialState::NOT_SIGNALED)) {
25 if (hashing) 27 if (hashing)
26 audio_hash_.reset(new AudioHash()); 28 audio_hash_.reset(new AudioHash());
27 } 29 }
28 30
29 void Start() { 31 void Start() {
30 stop_event_->Reset(); 32 stop_event_->Reset();
31 thread_.reset(new base::DelegateSimpleThread(this, "ClocklessAudioSink")); 33 thread_.reset(new base::DelegateSimpleThread(this, "ClocklessAudioSink"));
32 thread_->Start(); 34 thread_->Start();
33 } 35 }
34 36
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void ClocklessAudioSink::StartAudioHashForTesting() { 136 void ClocklessAudioSink::StartAudioHashForTesting() {
135 DCHECK(!initialized_); 137 DCHECK(!initialized_);
136 hashing_ = true; 138 hashing_ = true;
137 } 139 }
138 140
139 std::string ClocklessAudioSink::GetAudioHashForTesting() { 141 std::string ClocklessAudioSink::GetAudioHashForTesting() {
140 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string(); 142 return thread_ && hashing_ ? thread_->GetAudioHash() : std::string();
141 } 143 }
142 144
143 } // namespace media 145 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/scoped_task_runner_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698