OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <list> | 7 #include <list> |
| 8 #include <memory> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
13 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
15 #include "media/audio/audio_io.h" | 16 #include "media/audio/audio_io.h" |
16 #include "media/audio/simple_sources.h" | 17 #include "media/audio/simple_sources.h" |
17 #include "media/audio/virtual_audio_input_stream.h" | 18 #include "media/audio/virtual_audio_input_stream.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 222 |
222 private: | 223 private: |
223 void SyncWithAudioThread() { | 224 void SyncWithAudioThread() { |
224 base::WaitableEvent done(false, false); | 225 base::WaitableEvent done(false, false); |
225 audio_task_runner_->PostTask( | 226 audio_task_runner_->PostTask( |
226 FROM_HERE, | 227 FROM_HERE, |
227 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 228 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
228 done.Wait(); | 229 done.Wait(); |
229 } | 230 } |
230 | 231 |
231 scoped_ptr<base::Thread> audio_thread_; | 232 std::unique_ptr<base::Thread> audio_thread_; |
232 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; | 233 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; |
233 scoped_ptr<base::Thread> worker_thread_; | 234 std::unique_ptr<base::Thread> worker_thread_; |
234 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_; | 235 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_; |
235 | 236 |
236 VirtualAudioInputStream* stream_; | 237 VirtualAudioInputStream* stream_; |
237 MockInputCallback input_callback_; | 238 MockInputCallback input_callback_; |
238 base::WaitableEvent closed_stream_; | 239 base::WaitableEvent closed_stream_; |
239 | 240 |
240 std::list<AudioOutputStream*> output_streams_; | 241 std::list<AudioOutputStream*> output_streams_; |
241 std::list<AudioOutputStream*> stopped_output_streams_; | 242 std::list<AudioOutputStream*> stopped_output_streams_; |
242 TestAudioSource source_; | 243 TestAudioSource source_; |
243 | 244 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 343 } |
343 RUN_ON_AUDIO_THREAD(Close); | 344 RUN_ON_AUDIO_THREAD(Close); |
344 WaitUntilClosed(); | 345 WaitUntilClosed(); |
345 } | 346 } |
346 | 347 |
347 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, | 348 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, |
348 VirtualAudioInputStreamTest, | 349 VirtualAudioInputStreamTest, |
349 ::testing::Values(false, true)); | 350 ::testing::Values(false, true)); |
350 | 351 |
351 } // namespace media | 352 } // namespace media |
OLD | NEW |