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

Side by Side Diff: media/audio/fake_audio_output_stream.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: Rebase Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « media/audio/fake_audio_input_stream.cc ('k') | media/audio/fake_audio_output_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ 5 #ifndef MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_
6 #define MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ 6 #define MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "media/audio/audio_io.h" 9 #include "media/audio/audio_io.h"
10 #include "media/audio/audio_parameters.h" 10 #include "media/audio/audio_parameters.h"
11 #include "media/audio/fake_audio_consumer.h" 11 #include "media/audio/fake_audio_worker.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 class AudioManagerBase; 15 class AudioManagerBase;
16 16
17 // A fake implementation of AudioOutputStream. Used for testing and when a real 17 // A fake implementation of AudioOutputStream. Used for testing and when a real
18 // audio output device is unavailable or refusing output (e.g. remote desktop). 18 // audio output device is unavailable or refusing output (e.g. remote desktop).
19 // Callbacks are driven on the AudioManager's message loop. 19 // Callbacks are driven on the AudioManager's message loop.
20 class MEDIA_EXPORT FakeAudioOutputStream : public AudioOutputStream { 20 class MEDIA_EXPORT FakeAudioOutputStream : public AudioOutputStream {
21 public: 21 public:
22 static AudioOutputStream* MakeFakeStream(AudioManagerBase* manager, 22 static AudioOutputStream* MakeFakeStream(AudioManagerBase* manager,
23 const AudioParameters& params); 23 const AudioParameters& params);
24 24
25 // AudioOutputStream implementation. 25 // AudioOutputStream implementation.
26 bool Open() override; 26 bool Open() override;
27 void Start(AudioSourceCallback* callback) override; 27 void Start(AudioSourceCallback* callback) override;
28 void Stop() override; 28 void Stop() override;
29 void SetVolume(double volume) override; 29 void SetVolume(double volume) override;
30 void GetVolume(double* volume) override; 30 void GetVolume(double* volume) override;
31 void Close() override; 31 void Close() override;
32 32
33 private: 33 private:
34 FakeAudioOutputStream(AudioManagerBase* manager, 34 FakeAudioOutputStream(AudioManagerBase* manager,
35 const AudioParameters& params); 35 const AudioParameters& params);
36 ~FakeAudioOutputStream() override; 36 ~FakeAudioOutputStream() override;
37 37
38 // Task that periodically calls OnMoreData() to consume audio data. 38 // Task that periodically calls OnMoreData() to consume audio data.
39 void CallOnMoreData(AudioBus* audio_bus); 39 void CallOnMoreData();
40 40
41 AudioManagerBase* audio_manager_; 41 AudioManagerBase* audio_manager_;
42 AudioSourceCallback* callback_; 42 AudioSourceCallback* callback_;
43 FakeAudioConsumer fake_consumer_; 43 FakeAudioWorker fake_worker_;
44 scoped_ptr<AudioBus> audio_bus_;
44 45
45 DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream); 46 DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream);
46 }; 47 };
47 48
48 } // namespace media 49 } // namespace media
49 50
50 #endif // MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ 51 #endif // MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_
OLDNEW
« no previous file with comments | « media/audio/fake_audio_input_stream.cc ('k') | media/audio/fake_audio_output_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698