OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Creates a unified stream based on the cras (ChromeOS audio server) interface. | 5 // Creates a unified stream based on the cras (ChromeOS audio server) interface. |
6 // | 6 // |
7 // CrasUnifiedStream object is *not* thread-safe and should only be used | 7 // CrasUnifiedStream object is *not* thread-safe and should only be used |
8 // from the audio thread. | 8 // from the audio thread. |
9 | 9 |
10 #ifndef MEDIA_AUDIO_CRAS_CRAS_UNIFIED_H_ | 10 #ifndef MEDIA_AUDIO_CRAS_CRAS_UNIFIED_H_ |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Implementation of AudioOuputStream for Chrome OS using the Chrome OS audio | 29 // Implementation of AudioOuputStream for Chrome OS using the Chrome OS audio |
30 // server. | 30 // server. |
31 // TODO(dgreid): This class is used for only output, either remove all the | 31 // TODO(dgreid): This class is used for only output, either remove all the |
32 // relevant input code and change the class to CrasOutputStream or merge | 32 // relevant input code and change the class to CrasOutputStream or merge |
33 // cras_input.cc into this unified implementation. | 33 // cras_input.cc into this unified implementation. |
34 class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { | 34 class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { |
35 public: | 35 public: |
36 // The ctor takes all the usual parameters, plus |manager| which is the | 36 // The ctor takes all the usual parameters, plus |manager| which is the |
37 // audio manager who is creating this object. | 37 // audio manager who is creating this object. |
38 CrasUnifiedStream(const AudioParameters& params, AudioManagerCras* manager); | 38 CrasUnifiedStream(const AudioParameters& params, |
| 39 AudioManagerCras* manager, |
| 40 const std::string& device_id); |
39 | 41 |
40 // The dtor is typically called by the AudioManager only and it is usually | 42 // The dtor is typically called by the AudioManager only and it is usually |
41 // triggered by calling AudioUnifiedStream::Close(). | 43 // triggered by calling AudioUnifiedStream::Close(). |
42 ~CrasUnifiedStream() override; | 44 ~CrasUnifiedStream() override; |
43 | 45 |
44 // Implementation of AudioOutputStream. | 46 // Implementation of AudioOutputStream. |
45 bool Open() override; | 47 bool Open() override; |
46 void Close() override; | 48 void Close() override; |
47 void Start(AudioSourceCallback* callback) override; | 49 void Start(AudioSourceCallback* callback) override; |
48 void Stop() override; | 50 void Stop() override; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 106 |
105 // Callback to get audio samples. | 107 // Callback to get audio samples. |
106 AudioSourceCallback* source_callback_; | 108 AudioSourceCallback* source_callback_; |
107 | 109 |
108 // Container for exchanging data with AudioSourceCallback::OnMoreData(). | 110 // Container for exchanging data with AudioSourceCallback::OnMoreData(). |
109 std::unique_ptr<AudioBus> output_bus_; | 111 std::unique_ptr<AudioBus> output_bus_; |
110 | 112 |
111 // Direciton of the stream. | 113 // Direciton of the stream. |
112 CRAS_STREAM_DIRECTION stream_direction_; | 114 CRAS_STREAM_DIRECTION stream_direction_; |
113 | 115 |
| 116 // Index of the CRAS device to stream output to. |
| 117 int pin_device_; |
| 118 |
114 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); | 119 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); |
115 }; | 120 }; |
116 | 121 |
117 } // namespace media | 122 } // namespace media |
118 | 123 |
119 #endif // MEDIA_AUDIO_CRAS_CRAS_UNIFIED_H_ | 124 #endif // MEDIA_AUDIO_CRAS_CRAS_UNIFIED_H_ |
OLD | NEW |