OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_AUDIO_MODEM_AUDIO_RECORDER_IMPL_H_ | 5 #ifndef COMPONENTS_AUDIO_MODEM_AUDIO_RECORDER_IMPL_H_ |
6 #define COMPONENTS_AUDIO_MODEM_AUDIO_RECORDER_IMPL_H_ | 6 #define COMPONENTS_AUDIO_MODEM_AUDIO_RECORDER_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // AudioInputStream::AudioInputCallback overrides: | 72 // AudioInputStream::AudioInputCallback overrides: |
73 // Called by the audio recorder when a full packet of audio data is | 73 // Called by the audio recorder when a full packet of audio data is |
74 // available. This is called from a special audio thread and the | 74 // available. This is called from a special audio thread and the |
75 // implementation should return as soon as possible. | 75 // implementation should return as soon as possible. |
76 void OnData(media::AudioInputStream* stream, | 76 void OnData(media::AudioInputStream* stream, |
77 const media::AudioBus* source, | 77 const media::AudioBus* source, |
78 uint32_t hardware_delay_bytes, | 78 uint32_t hardware_delay_bytes, |
79 double volume) override; | 79 double volume) override; |
80 void OnError(media::AudioInputStream* stream) override; | 80 void OnError(media::AudioInputStream* stream) override; |
81 | 81 |
| 82 // Flushes the audio loop, making sure that any queued operations are |
| 83 // performed. |
| 84 void FlushAudioLoopForTesting(); |
| 85 |
82 bool is_recording_; | 86 bool is_recording_; |
83 | 87 |
84 media::AudioInputStream* stream_; | 88 media::AudioInputStream* stream_; |
85 | 89 |
86 RecordedSamplesCallback decode_callback_; | 90 RecordedSamplesCallback decode_callback_; |
87 | 91 |
88 // Outside of the ctor/Initialize method, only access the next variables on | 92 // Outside of the ctor/Initialize method, only access the next variables on |
89 // the recording thread. | 93 // the recording thread. |
90 scoped_ptr<media::AudioBus> buffer_; | 94 scoped_ptr<media::AudioBus> buffer_; |
91 int total_buffer_frames_; | 95 int total_buffer_frames_; |
92 int buffer_frame_index_; | 96 int buffer_frame_index_; |
93 | 97 |
94 scoped_ptr<media::AudioInputStream> input_stream_for_testing_; | 98 scoped_ptr<media::AudioInputStream> input_stream_for_testing_; |
95 scoped_ptr<media::AudioParameters> params_for_testing_; | 99 scoped_ptr<media::AudioParameters> params_for_testing_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(AudioRecorderImpl); | 101 DISALLOW_COPY_AND_ASSIGN(AudioRecorderImpl); |
98 }; | 102 }; |
99 | 103 |
100 } // namespace audio_modem | 104 } // namespace audio_modem |
101 | 105 |
102 #endif // COMPONENTS_AUDIO_MODEM_AUDIO_RECORDER_IMPL_H_ | 106 #endif // COMPONENTS_AUDIO_MODEM_AUDIO_RECORDER_IMPL_H_ |
OLD | NEW |