| 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_(Platform::Current()->CreateThread("client thread")), | 49 client_thread_(WTF::WrapUnique( |
| 50 Platform::Current()->CreateThread("client thread"))), |
| 50 jitter_range_ms_(jitter_range_ms) {} | 51 jitter_range_ms_(jitter_range_ms) {} |
| 51 | 52 |
| 52 void Start(double duration_ms, double interval_ms) { | 53 void Start(double duration_ms, double interval_ms) { |
| 53 duration_ms_ = duration_ms; | 54 duration_ms_ = duration_ms; |
| 54 interval_ms_ = interval_ms; | 55 interval_ms_ = interval_ms; |
| 55 client_thread_->GetWebTaskRunner()->PostTask( | 56 client_thread_->GetWebTaskRunner()->PostTask( |
| 56 BLINK_FROM_HERE, | 57 BLINK_FROM_HERE, |
| 57 CrossThreadBind(&FIFOClient::RunTaskOnOwnThread, | 58 CrossThreadBind(&FIFOClient::RunTaskOnOwnThread, |
| 58 CrossThreadUnretained(this))); | 59 CrossThreadUnretained(this))); |
| 59 } | 60 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 {48000, 2, 8192, 10000, 256, 0, 128, 1} | 226 {48000, 2, 8192, 10000, 256, 0, 128, 1} |
| 226 }; | 227 }; |
| 227 | 228 |
| 228 INSTANTIATE_TEST_CASE_P(PushPullFIFOSmokeTest, | 229 INSTANTIATE_TEST_CASE_P(PushPullFIFOSmokeTest, |
| 229 PushPullFIFOSmokeTest, | 230 PushPullFIFOSmokeTest, |
| 230 ::testing::ValuesIn(smoke_test_params)); | 231 ::testing::ValuesIn(smoke_test_params)); |
| 231 | 232 |
| 232 } // namespace | 233 } // namespace |
| 233 | 234 |
| 234 } // namespace blink | 235 } // namespace blink |
| OLD | NEW |