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

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

Issue 11878032: Plumb |input_channels| all the way to AudioManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 #ifndef MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_
6 #define MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ 6 #define MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 19 matching lines...) Expand all
30 // TODO(tommi): Multiple audio input/output device instances should be able to 30 // TODO(tommi): Multiple audio input/output device instances should be able to
31 // share the same thread instead of spinning one per instance. 31 // share the same thread instead of spinning one per instance.
32 class MEDIA_EXPORT AudioDeviceThread { 32 class MEDIA_EXPORT AudioDeviceThread {
33 public: 33 public:
34 // This is the callback interface/base class that Audio[Output|Input]Device 34 // This is the callback interface/base class that Audio[Output|Input]Device
35 // implements to render input/output data. The callbacks run on the 35 // implements to render input/output data. The callbacks run on the
36 // thread owned by AudioDeviceThread. 36 // thread owned by AudioDeviceThread.
37 class Callback { 37 class Callback {
38 public: 38 public:
39 Callback(const AudioParameters& audio_parameters, 39 Callback(const AudioParameters& audio_parameters,
40 int input_channels,
41 base::SharedMemoryHandle memory, 40 base::SharedMemoryHandle memory,
42 int memory_length); 41 int memory_length);
43 virtual ~Callback(); 42 virtual ~Callback();
44 43
45 // One time initialization for the callback object on the audio thread. 44 // One time initialization for the callback object on the audio thread.
46 void InitializeOnAudioThread(); 45 void InitializeOnAudioThread();
47 46
48 // Derived implementations must call shared_memory_.Map appropriately 47 // Derived implementations must call shared_memory_.Map appropriately
49 // before Process can be called. 48 // before Process can be called.
50 virtual void MapSharedMemory() = 0; 49 virtual void MapSharedMemory() = 0;
51 50
52 // Called whenever we receive notifications about pending data. 51 // Called whenever we receive notifications about pending data.
53 virtual void Process(int pending_data) = 0; 52 virtual void Process(int pending_data) = 0;
54 53
55 protected: 54 protected:
56 // Protected so that derived classes can access directly. 55 // Protected so that derived classes can access directly.
57 // The variables are 'const' since values are calculated/set in the 56 // The variables are 'const' since values are calculated/set in the
58 // constructor and must never change. 57 // constructor and must never change.
59 const AudioParameters audio_parameters_; 58 const AudioParameters audio_parameters_;
60 const int input_channels_;
61 const int samples_per_ms_; 59 const int samples_per_ms_;
62 const int bytes_per_ms_; 60 const int bytes_per_ms_;
63 61
64 base::SharedMemory shared_memory_; 62 base::SharedMemory shared_memory_;
65 const int memory_length_; 63 const int memory_length_;
66 64
67 private: 65 private:
68 DISALLOW_COPY_AND_ASSIGN(Callback); 66 DISALLOW_COPY_AND_ASSIGN(Callback);
69 }; 67 };
70 68
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 100
103 base::Lock thread_lock_; 101 base::Lock thread_lock_;
104 scoped_refptr<AudioDeviceThread::Thread> thread_; 102 scoped_refptr<AudioDeviceThread::Thread> thread_;
105 103
106 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); 104 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread);
107 }; 105 };
108 106
109 } // namespace media. 107 } // namespace media.
110 108
111 #endif // MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_ 109 #endif // MEDIA_AUDIO_AUDIO_DEVICE_THREAD_H_
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | media/audio/audio_device_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698