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

Unified Diff: third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp

Issue 2940933003: DO NOT SUBMIT results of new clang-format (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
diff --git a/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp b/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
index 6f21f47d00c7ee21e65cdd239a98390e56d37b46..bf5bcbdd537c962b3cd7a77be19ba6ec4864dba1 100644
--- a/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
+++ b/third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp
@@ -36,27 +36,23 @@ class FIFOClient {
duration_ms_ = duration_ms;
interval_ms_ = interval_ms;
client_thread_->GetWebTaskRunner()->PostTask(
- BLINK_FROM_HERE,
- CrossThreadBind(&FIFOClient::RunTaskOnOwnThread,
- CrossThreadUnretained(this)));
+ BLINK_FROM_HERE, CrossThreadBind(&FIFOClient::RunTaskOnOwnThread,
+ CrossThreadUnretained(this)));
return done_event_.get();
}
virtual void Stop(int callback_counter) = 0;
virtual void RunTask() = 0;
- void Pull(size_t frames_to_pull) {
- fifo_->Pull(bus_.Get(), frames_to_pull);
- }
+ void Pull(size_t frames_to_pull) { fifo_->Pull(bus_.Get(), frames_to_pull); }
- void Push() {
- fifo_->Push(bus_.Get());
- }
+ void Push() { fifo_->Push(bus_.Get()); }
private:
void RunTaskOnOwnThread() {
- double interval_with_jitter = interval_ms_
- + (static_cast<double>(std::rand()) / RAND_MAX) * jitter_range_ms_;
+ double interval_with_jitter =
+ interval_ms_ +
+ (static_cast<double>(std::rand()) / RAND_MAX) * jitter_range_ms_;
elapsed_ms_ += interval_with_jitter;
++counter_;
RunTask();
@@ -100,12 +96,9 @@ class PullClient : public FIFOClient {
public:
PullClient(PushPullFIFO* fifo, size_t frames_to_pull, double jitter_range_ms)
: FIFOClient(fifo, frames_to_pull, jitter_range_ms),
- frames_to_pull_(frames_to_pull) {
- }
+ frames_to_pull_(frames_to_pull) {}
- void RunTask() override {
- Pull(frames_to_pull_);
- }
+ void RunTask() override { Pull(frames_to_pull_); }
void Stop(int callback_counter) override {
LOG(INFO) << "PullClient stopped. (" << callback_counter << " calls)";
@@ -122,9 +115,7 @@ class PushClient : public FIFOClient {
PushClient(PushPullFIFO* fifo, size_t frames_to_push, double jitter_range_ms)
: FIFOClient(fifo, frames_to_push, jitter_range_ms) {}
- void RunTask() override {
- Push();
- }
+ void RunTask() override { Push(); }
void Stop(int callback_counter) override {
LOG(INFO) << "PushClient stopped. (" << callback_counter << " calls)";
@@ -153,10 +144,8 @@ TEST_P(PushPullFIFOSmokeTest, SmokeTests) {
const FIFOSmokeTestParam param = GetParam();
const double sample_rate = param.sample_rate * 4;
- const double pull_interval_ms =
- param.pull_buffer_size / sample_rate * 1000;
- const double push_interval_ms =
- param.push_buffer_size / sample_rate * 1000;
+ const double pull_interval_ms = param.pull_buffer_size / sample_rate * 1000;
+ const double push_interval_ms = param.push_buffer_size / sample_rate * 1000;
std::unique_ptr<PushPullFIFO> test_fifo = WTF::WrapUnique(
new PushPullFIFO(param.number_of_channels, param.fifo_length));
@@ -179,40 +168,40 @@ TEST_P(PushPullFIFOSmokeTest, SmokeTests) {
}
FIFOSmokeTestParam smoke_test_params[] = {
- // Test case 0 (OSX): 256 Pull, 128 Push, Minimal jitter.
- // WebThread's priority is lower than the device thread, so its jitter range
- // is slightly bigger than the other.
- {48000, 2, 8192, 1000, 256, 1, 128, 2},
-
- // Test case 1 (Windows): 441 Pull, 128 Push. Moderate Jitter.
- // Windows' audio callback is known to be ~10ms and UMA data shows the
- // evidence for it. The jitter range was determined speculatively.
- {44100, 2, 8192, 1000, 441, 2, 128, 3},
-
- // Test case 2 (Ubuntu/Linux): 512 Pull, 128 Push. Unstable callback, but
- // fast CPU. A typical configuration for Ubuntu + PulseAudio setup.
- // PulseAudio's callback is known to be rather unstable.
- {48000, 2, 8192, 1000, 512, 8, 128, 1},
-
- // Test case 3 (Android-Reference): 512 Pull, 128 Push. Similar to Linux, but
- // low profile CPU.
- {44100, 2, 8192, 1000, 512, 8, 128, 3},
-
- // Test case 4 (Android-ExternalA): 441 Pull, 128 Push. Extreme jitter with
- // low profile CPU.
- {44100, 2, 8192, 1000, 441, 24, 128, 8},
-
- // Test case 5 (Android-ExternalB): 5768 Pull, 128 Push. Huge callback with
- // large jitter. Low profile CPU.
- {44100, 2, 8192, 1000, 5768, 120, 128, 12},
-
- // Test case 6 (User-specified buffer size): 960 Pull, 128 Push. Minimal
- // Jitter. 960 frames = 20ms at 48KHz.
- {48000, 2, 8192, 1000, 960, 1, 128, 1},
-
- // Test case 7 (Longer test duration): 256 Pull, 128 Push. 10 seconds.
- {48000, 2, 8192, 10000, 256, 0, 128, 1}
-};
+ // Test case 0 (OSX): 256 Pull, 128 Push, Minimal jitter.
+ // WebThread's priority is lower than the device thread, so its jitter range
+ // is slightly bigger than the other.
+ {48000, 2, 8192, 1000, 256, 1, 128, 2},
+
+ // Test case 1 (Windows): 441 Pull, 128 Push. Moderate Jitter.
+ // Windows' audio callback is known to be ~10ms and UMA data shows the
+ // evidence for it. The jitter range was determined speculatively.
+ {44100, 2, 8192, 1000, 441, 2, 128, 3},
+
+ // Test case 2 (Ubuntu/Linux): 512 Pull, 128 Push. Unstable callback, but
+ // fast CPU. A typical configuration for Ubuntu + PulseAudio setup.
+ // PulseAudio's callback is known to be rather unstable.
+ {48000, 2, 8192, 1000, 512, 8, 128, 1},
+
+ // Test case 3 (Android-Reference): 512 Pull, 128 Push. Similar to Linux,
+ // but
+ // low profile CPU.
+ {44100, 2, 8192, 1000, 512, 8, 128, 3},
+
+ // Test case 4 (Android-ExternalA): 441 Pull, 128 Push. Extreme jitter with
+ // low profile CPU.
+ {44100, 2, 8192, 1000, 441, 24, 128, 8},
+
+ // Test case 5 (Android-ExternalB): 5768 Pull, 128 Push. Huge callback with
+ // large jitter. Low profile CPU.
+ {44100, 2, 8192, 1000, 5768, 120, 128, 12},
+
+ // Test case 6 (User-specified buffer size): 960 Pull, 128 Push. Minimal
+ // Jitter. 960 frames = 20ms at 48KHz.
+ {48000, 2, 8192, 1000, 960, 1, 128, 1},
+
+ // Test case 7 (Longer test duration): 256 Pull, 128 Push. 10 seconds.
+ {48000, 2, 8192, 10000, 256, 0, 128, 1}};
INSTANTIATE_TEST_CASE_P(PushPullFIFOSmokeTest,
PushPullFIFOSmokeTest,

Powered by Google App Engine
This is Rietveld 408576698