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

Unified Diff: media/audio/fake_audio_worker.h

Issue 922663002: Moved the fake input stream's processing onto the audio worker thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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: media/audio/fake_audio_worker.h
diff --git a/media/audio/fake_audio_consumer.h b/media/audio/fake_audio_worker.h
similarity index 52%
rename from media/audio/fake_audio_consumer.h
rename to media/audio/fake_audio_worker.h
index 18c552ad97be9593dcdd370dd4bf20f50943df97..6eb61d1378a427c7aad756e5016c9ce3eaf2edd0 100644
--- a/media/audio/fake_audio_consumer.h
+++ b/media/audio/fake_audio_worker.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MEDIA_AUDIO_FAKE_AUDIO_CONSUMER_H_
-#define MEDIA_AUDIO_FAKE_AUDIO_CONSUMER_H_
+#ifndef MEDIA_AUDIO_FAKE_AUDIO_WORKER_H_
+#define MEDIA_AUDIO_FAKE_AUDIO_WORKER_H_
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
@@ -17,27 +17,27 @@ namespace media {
class AudioBus;
class AudioParameters;
-// A fake audio consumer. Using a provided message loop, FakeAudioConsumer will
-// simulate a real time consumer of audio data.
-class MEDIA_EXPORT FakeAudioConsumer {
+// A fake audio worker. Using a provided message loop, FakeAudioWorker will
+// call back the provided callback like a real audio consumer or producer would.
+class MEDIA_EXPORT FakeAudioWorker {
public:
- // |worker_task_runner| is the task runner on which the ReadCB provided to
+ // |worker_task_runner| is the task runner on which the WorkerCB provided to
// Start() will be executed on. This may or may not be the be for the same
// thread that invokes the Start/Stop methods.
// |params| is used to determine the frequency of callbacks.
- FakeAudioConsumer(
+ FakeAudioWorker(
const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner,
const AudioParameters& params);
- ~FakeAudioConsumer();
+ ~FakeAudioWorker();
- // Start executing |read_cb| at a regular intervals. Stop() must be called by
- // the same thread before destroying FakeAudioConsumer.
- typedef base::Callback<void(AudioBus* audio_bus)> ReadCB;
- void Start(const ReadCB& read_cb);
+ // Start executing |worker_cb| at a regular intervals. Stop() must be called
+ // by the same thread before destroying FakeAudioWorker.
+ typedef base::Callback<void()> WorkerCB;
DaleCurtis 2015/02/18 19:04:49 Delete typedef in favor of base::Closure.
phoglund_chromium 2015/02/19 15:44:11 Done.
+ void Start(const WorkerCB& worker_cb);
- // Stop executing the ReadCB provided to Start(). Blocks until the worker
- // loop is not inside a ReadCB invocation. Safe to call multiple times. Must
- // be called on the same thread that called Start().
+ // Stop executing the WorkerCB provided to Start(). Blocks until the worker
+ // loop is not inside a WorkerCB invocation. Safe to call multiple times.
+ // Must be called on the same thread that called Start().
void Stop();
private:
@@ -47,9 +47,9 @@ class MEDIA_EXPORT FakeAudioConsumer {
class Worker;
const scoped_refptr<Worker> worker_;
- DISALLOW_COPY_AND_ASSIGN(FakeAudioConsumer);
+ DISALLOW_COPY_AND_ASSIGN(FakeAudioWorker);
};
} // namespace media
-#endif // MEDIA_AUDIO_FAKE_AUDIO_CONSUMER_H_
+#endif // MEDIA_AUDIO_FAKE_AUDIO_WORKER_H_

Powered by Google App Engine
This is Rietveld 408576698