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

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

Issue 4661001: Simplified AudioOutputStream interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_parameters.cc ('k') | media/audio/fake_audio_input_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // A fake implementation of AudioInputStream, useful for testing purpose. 5 // A fake implementation of AudioInputStream, useful for testing purpose.
6 6
7 #ifndef MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ 7 #ifndef MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_
8 #define MEDIA_AUDIO_FAKE_AUDIO_INOUT_STREAM_H_ 8 #define MEDIA_AUDIO_FAKE_AUDIO_INOUT_STREAM_H_
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/thread.h" 14 #include "base/thread.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "media/audio/audio_io.h" 16 #include "media/audio/audio_io.h"
17 #include "media/audio/audio_parameters.h" 17 #include "media/audio/audio_parameters.h"
18 18
19 class FakeAudioInputStream : 19 class FakeAudioInputStream :
20 public AudioInputStream, 20 public AudioInputStream,
21 public base::RefCountedThreadSafe<FakeAudioInputStream> { 21 public base::RefCountedThreadSafe<FakeAudioInputStream> {
22 public: 22 public:
23 static AudioInputStream* MakeFakeStream(AudioParameters params, 23 static AudioInputStream* MakeFakeStream(AudioParameters params);
24 int samples_per_packet);
25 24
26 virtual bool Open(); 25 virtual bool Open();
27 virtual void Start(AudioInputCallback* callback); 26 virtual void Start(AudioInputCallback* callback);
28 virtual void Stop(); 27 virtual void Stop();
29 virtual void Close(); 28 virtual void Close();
30 29
31 private: 30 private:
32 // Give RefCountedThreadSafe access our destructor. 31 // Give RefCountedThreadSafe access our destructor.
33 friend class base::RefCountedThreadSafe<FakeAudioInputStream>; 32 friend class base::RefCountedThreadSafe<FakeAudioInputStream>;
34 33
35 FakeAudioInputStream(AudioParameters params, int samples_per_packet); 34 FakeAudioInputStream(AudioParameters params);
36 virtual ~FakeAudioInputStream(); 35 virtual ~FakeAudioInputStream();
37 36
38 void DoCallback(); 37 void DoCallback();
39 38
40 AudioInputCallback* callback_; 39 AudioInputCallback* callback_;
41 scoped_array<uint8> buffer_; 40 scoped_array<uint8> buffer_;
42 int buffer_size_; 41 int buffer_size_;
43 base::Thread thread_; 42 base::Thread thread_;
44 base::Time last_callback_time_; 43 base::Time last_callback_time_;
45 int callback_interval_ms_; 44 int callback_interval_ms_;
46 45
47 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); 46 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream);
48 }; 47 };
49 48
50 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ 49 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_
OLDNEW
« no previous file with comments | « media/audio/audio_parameters.cc ('k') | media/audio/fake_audio_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698