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

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

Issue 9418042: Adding microphone volume support to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added a comment about the number of channel, and fix a compiling issue on mac Created 8 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 unified diff | Download patch | Annotate | Revision Log
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 // 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/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/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(const AudioParameters& params); 23 static AudioInputStream* MakeFakeStream(const AudioParameters& params);
24 24
25 virtual bool Open() OVERRIDE; 25 virtual bool Open() OVERRIDE;
26 virtual void Start(AudioInputCallback* callback) OVERRIDE; 26 virtual void Start(AudioInputCallback* callback) OVERRIDE;
27 virtual void Stop() OVERRIDE; 27 virtual void Stop() OVERRIDE;
28 virtual void Close() OVERRIDE; 28 virtual void Close() OVERRIDE;
29 virtual double GetMaxVolume() OVERRIDE;
30 virtual void SetVolume(double volume) OVERRIDE;
31 virtual double GetVolume() OVERRIDE;
29 32
30 private: 33 private:
31 // Give RefCountedThreadSafe access our destructor. 34 // Give RefCountedThreadSafe access our destructor.
32 friend class base::RefCountedThreadSafe<FakeAudioInputStream>; 35 friend class base::RefCountedThreadSafe<FakeAudioInputStream>;
33 36
34 FakeAudioInputStream(const AudioParameters& params); 37 FakeAudioInputStream(const AudioParameters& params);
35 virtual ~FakeAudioInputStream(); 38 virtual ~FakeAudioInputStream();
36 39
37 void DoCallback(); 40 void DoCallback();
38 41
39 AudioInputCallback* callback_; 42 AudioInputCallback* callback_;
40 scoped_array<uint8> buffer_; 43 scoped_array<uint8> buffer_;
41 int buffer_size_; 44 int buffer_size_;
42 base::Thread thread_; 45 base::Thread thread_;
43 base::Time last_callback_time_; 46 base::Time last_callback_time_;
44 base::TimeDelta callback_interval_; 47 base::TimeDelta callback_interval_;
45 48
46 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream); 49 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputStream);
47 }; 50 };
48 51
49 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_ 52 #endif // MEDIA_AUDIO_FAKE_AUDIO_INPUT_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698