OLD | NEW |
---|---|
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_CRAS_CRAS_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ |
6 #define MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ | 6 #define MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ |
7 | 7 |
8 #include <cras_client.h> | 8 #include <cras_client.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/cancelable_callback.h" | |
dgreid
2014/09/17 21:16:23
Don't need this one.
rpetterson
2014/09/17 21:32:00
Done.
| |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "media/audio/agc_audio_stream.h" | 14 #include "media/audio/agc_audio_stream.h" |
14 #include "media/audio/audio_io.h" | 15 #include "media/audio/audio_io.h" |
15 #include "media/audio/audio_parameters.h" | 16 #include "media/audio/audio_parameters.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 class AudioManagerCras; | 20 class AudioManagerCras; |
20 | 21 |
21 // Provides an input stream for audio capture based on CRAS, the ChromeOS Audio | 22 // Provides an input stream for audio capture based on CRAS, the ChromeOS Audio |
(...skipping 22 matching lines...) Expand all Loading... | |
44 private: | 45 private: |
45 // Handles requests to get samples from the provided buffer. This will be | 46 // Handles requests to get samples from the provided buffer. This will be |
46 // called by the audio server when it has samples ready. | 47 // called by the audio server when it has samples ready. |
47 static int SamplesReady(cras_client* client, | 48 static int SamplesReady(cras_client* client, |
48 cras_stream_id_t stream_id, | 49 cras_stream_id_t stream_id, |
49 uint8* samples, | 50 uint8* samples, |
50 size_t frames, | 51 size_t frames, |
51 const timespec* sample_ts, | 52 const timespec* sample_ts, |
52 void* arg); | 53 void* arg); |
53 | 54 |
55 // Handles requests to get a sample from the provided buffer. This will be | |
dgreid
2014/09/17 21:16:23
I'd remove the first sentence of this comment.
rpetterson
2014/09/17 21:32:01
Done.
| |
56 // called by the audio server once after it recieves a wakeup and has data. | |
57 static int HotwordSampleReady(cras_client* client, | |
58 cras_audio_format* fmt, | |
59 uint8* hotword_phrase, | |
60 size_t frames, | |
61 const timespec* sample_ts, | |
62 void* arg); | |
63 | |
54 // Handles notification that there was an error with the playback stream. | 64 // Handles notification that there was an error with the playback stream. |
55 static int StreamError(cras_client* client, | 65 static int StreamError(cras_client* client, |
56 cras_stream_id_t stream_id, | 66 cras_stream_id_t stream_id, |
57 int err, | 67 int err, |
58 void* arg); | 68 void* arg); |
59 | 69 |
60 // Reads one or more buffers of audio from the device, passes on to the | 70 // Reads one or more buffers of audio from the device, passes on to the |
61 // registered callback. Called from SamplesReady(). | 71 // registered callback. Called from SamplesReady(). |
62 void ReadAudio(size_t frames, uint8* buffer, const timespec* sample_ts); | 72 void ReadAudio(size_t frames, uint8* buffer, const timespec* sample_ts); |
63 | 73 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 const CRAS_STREAM_DIRECTION stream_direction_; | 109 const CRAS_STREAM_DIRECTION stream_direction_; |
100 | 110 |
101 scoped_ptr<AudioBus> audio_bus_; | 111 scoped_ptr<AudioBus> audio_bus_; |
102 | 112 |
103 DISALLOW_COPY_AND_ASSIGN(CrasInputStream); | 113 DISALLOW_COPY_AND_ASSIGN(CrasInputStream); |
104 }; | 114 }; |
105 | 115 |
106 } // namespace media | 116 } // namespace media |
107 | 117 |
108 #endif // MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ | 118 #endif // MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ |
OLD | NEW |