OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "platform/audio/PushPullFIFO.h" | 5 #include "platform/audio/PushPullFIFO.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 #include "platform/CrossThreadFunctional.h" | 9 #include "platform/CrossThreadFunctional.h" |
10 #include "platform/WaitableEvent.h" | 10 #include "platform/WaitableEvent.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 testing::EnterRunLoop(); | 39 testing::EnterRunLoop(); |
40 } | 40 } |
41 | 41 |
42 // Base FIFOClient with an extra thread for looping and jitter control. The | 42 // Base FIFOClient with an extra thread for looping and jitter control. The |
43 // child class must define a specific task to run on the thread. | 43 // child class must define a specific task to run on the thread. |
44 class FIFOClient { | 44 class FIFOClient { |
45 public: | 45 public: |
46 FIFOClient(PushPullFIFO* fifo, size_t bus_length, size_t jitter_range_ms) | 46 FIFOClient(PushPullFIFO* fifo, size_t bus_length, size_t jitter_range_ms) |
47 : fifo_(fifo), | 47 : fifo_(fifo), |
48 bus_(AudioBus::Create(fifo->NumberOfChannels(), bus_length)), | 48 bus_(AudioBus::Create(fifo->NumberOfChannels(), bus_length)), |
49 client_thread_(WTF::WrapUnique( | 49 client_thread_(Platform::Current()->CreateThread("client thread")), |
50 Platform::Current()->CreateThread("client thread"))), | |
51 jitter_range_ms_(jitter_range_ms) {} | 50 jitter_range_ms_(jitter_range_ms) {} |
52 | 51 |
53 void Start(double duration_ms, double interval_ms) { | 52 void Start(double duration_ms, double interval_ms) { |
54 duration_ms_ = duration_ms; | 53 duration_ms_ = duration_ms; |
55 interval_ms_ = interval_ms; | 54 interval_ms_ = interval_ms; |
56 client_thread_->GetWebTaskRunner()->PostTask( | 55 client_thread_->GetWebTaskRunner()->PostTask( |
57 BLINK_FROM_HERE, | 56 BLINK_FROM_HERE, |
58 CrossThreadBind(&FIFOClient::RunTaskOnOwnThread, | 57 CrossThreadBind(&FIFOClient::RunTaskOnOwnThread, |
59 CrossThreadUnretained(this))); | 58 CrossThreadUnretained(this))); |
60 } | 59 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 {48000, 2, 8192, 10000, 256, 0, 128, 1} | 225 {48000, 2, 8192, 10000, 256, 0, 128, 1} |
227 }; | 226 }; |
228 | 227 |
229 INSTANTIATE_TEST_CASE_P(PushPullFIFOSmokeTest, | 228 INSTANTIATE_TEST_CASE_P(PushPullFIFOSmokeTest, |
230 PushPullFIFOSmokeTest, | 229 PushPullFIFOSmokeTest, |
231 ::testing::ValuesIn(smoke_test_params)); | 230 ::testing::ValuesIn(smoke_test_params)); |
232 | 231 |
233 } // namespace | 232 } // namespace |
234 | 233 |
235 } // namespace blink | 234 } // namespace blink |
OLD | NEW |