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

Side by Side Diff: media/audio/fake_audio_output_stream.h

Issue 2507643002: Removes tracking for fake audio streams. (Closed)
Patch Set: Created 4 years, 1 month 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_manager.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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "media/audio/audio_io.h" 11 #include "media/audio/audio_io.h"
12 #include "media/audio/fake_audio_worker.h" 12 #include "media/audio/fake_audio_worker.h"
13 #include "media/base/audio_parameters.h" 13 #include "media/base/audio_parameters.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 class AudioManagerBase;
18
19 // 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
20 // 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).
21 // Callbacks are driven on the AudioManager's message loop. 19 // Callbacks are driven on the AudioManager's message loop.
22 class MEDIA_EXPORT FakeAudioOutputStream : public AudioOutputStream { 20 class MEDIA_EXPORT FakeAudioOutputStream : public AudioOutputStream {
23 public: 21 public:
24 static AudioOutputStream* MakeFakeStream(AudioManagerBase* manager, 22 static AudioOutputStream* MakeFakeStream(
25 const AudioParameters& params); 23 const scoped_refptr<base::SingleThreadTaskRunner>& audio_task_runner,
24 const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner,
25 const AudioParameters& params);
26 26
27 // AudioOutputStream implementation. 27 // AudioOutputStream implementation.
28 bool Open() override; 28 bool Open() override;
29 void Start(AudioSourceCallback* callback) override; 29 void Start(AudioSourceCallback* callback) override;
30 void Stop() override; 30 void Stop() override;
31 void SetVolume(double volume) override; 31 void SetVolume(double volume) override;
32 void GetVolume(double* volume) override; 32 void GetVolume(double* volume) override;
33 void Close() override; 33 void Close() override;
34 34
35 private: 35 private:
36 FakeAudioOutputStream(AudioManagerBase* manager, 36 FakeAudioOutputStream(
37 const AudioParameters& params); 37 const scoped_refptr<base::SingleThreadTaskRunner>& audio_task_runner,
38 const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner,
39 const AudioParameters& params);
38 ~FakeAudioOutputStream() override; 40 ~FakeAudioOutputStream() override;
39 41
40 // Task that periodically calls OnMoreData() to consume audio data. 42 // Task that periodically calls OnMoreData() to consume audio data.
41 void CallOnMoreData(); 43 void CallOnMoreData();
42 44
43 AudioManagerBase* audio_manager_;
44 AudioSourceCallback* callback_; 45 AudioSourceCallback* callback_;
45 FakeAudioWorker fake_worker_; 46 FakeAudioWorker fake_worker_;
47 const scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
48 const scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_;
46 std::unique_ptr<AudioBus> audio_bus_; 49 std::unique_ptr<AudioBus> audio_bus_;
47 50
48 DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream); 51 DISALLOW_COPY_AND_ASSIGN(FakeAudioOutputStream);
49 }; 52 };
50 53
51 } // namespace media 54 } // namespace media
52 55
53 #endif // MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_ 56 #endif // MEDIA_AUDIO_FAKE_AUDIO_OUTPUT_STREAM_H_
OLDNEW
« no previous file with comments | « media/audio/fake_audio_manager.cc ('k') | media/audio/fake_audio_output_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698