Chromium Code Reviews| Index: components/copresence/mediums/audio/audio_recorder.h |
| diff --git a/components/copresence/mediums/audio/audio_recorder.h b/components/copresence/mediums/audio/audio_recorder.h |
| index 5c68eca1808b5c064be2f6426514559186b0adc8..cb2a8f94a7b15e275b98a5575b4e47c1e22cb019 100644 |
| --- a/components/copresence/mediums/audio/audio_recorder.h |
| +++ b/components/copresence/mediums/audio/audio_recorder.h |
| @@ -14,101 +14,26 @@ |
| #include "media/audio/audio_parameters.h" |
| #include "media/base/audio_converter.h" |
| -namespace base { |
| -class MessageLoop; |
| -} |
| - |
| -namespace media { |
| -class AudioBus; |
| -} |
| - |
| namespace copresence { |
| // The AudioRecorder class will record audio until told to stop. |
| -class AudioRecorder : public media::AudioInputStream::AudioInputCallback, |
| - public media::AudioConverter::InputCallback { |
| +class AudioRecorder { |
| public: |
| - typedef base::Callback<void(const std::string&)> DecodeSamplesCallback; |
| - |
| - explicit AudioRecorder(const DecodeSamplesCallback& decode_callback); |
| + typedef base::Callback<void(const std::string&)> RecordedSamplesCallback; |
| // Initializes the object. Do not use this object before calling this method. |
| - virtual void Initialize(); |
| + virtual void Initialize(const RecordedSamplesCallback& decode_callback) = 0; |
| - virtual void Record(); |
| - virtual void Stop(); |
| + virtual void Record() = 0; |
| + virtual void Stop() = 0; |
| // Cleans up and deletes this object. Do not use object after this call. |
| - virtual void Finalize(); |
| - |
| - bool IsRecording(); |
| - |
| - // Takes ownership of the stream. |
| - void set_input_stream_for_testing( |
| - media::AudioInputStream* input_stream_for_testing) { |
| - input_stream_for_testing_.reset(input_stream_for_testing); |
| - } |
| + virtual void Finalize() = 0; |
| - // Takes ownership of the params. |
| - void set_params_for_testing(media::AudioParameters* params_for_testing) { |
| - params_for_testing_.reset(params_for_testing); |
| - } |
| + virtual bool IsRecording() = 0; |
| protected: |
| - virtual ~AudioRecorder(); |
| - void set_is_recording(bool is_recording) { is_recording_ = is_recording; } |
| - |
| - private: |
| - friend class AudioRecorderTest; |
| - FRIEND_TEST_ALL_PREFIXES(AudioRecorderTest, BasicRecordAndStop); |
| - FRIEND_TEST_ALL_PREFIXES(AudioRecorderTest, OutOfOrderRecordAndStopMultiple); |
| - |
| - // Methods to do our various operations; all of these need to be run on the |
| - // audio thread. |
| - void InitializeOnAudioThread(); |
| - void RecordOnAudioThread(); |
| - void StopOnAudioThread(); |
| - void StopAndCloseOnAudioThread(); |
| - void FinalizeOnAudioThread(); |
| - |
| - // AudioInputStream::AudioInputCallback overrides: |
| - // Called by the audio recorder when a full packet of audio data is |
| - // available. This is called from a special audio thread and the |
| - // implementation should return as soon as possible. |
| - virtual void OnData(media::AudioInputStream* stream, |
| - const media::AudioBus* source, |
| - uint32 hardware_delay_bytes, |
| - double volume) override; |
| - virtual void OnError(media::AudioInputStream* stream) override; |
| - |
| - // AudioConverter::InputCallback overrides: |
| - virtual double ProvideInput(media::AudioBus* dest, |
| - base::TimeDelta buffer_delay) override; |
| - |
| - // Flushes the audio loop, making sure that any queued operations are |
| - // performed. |
| - void FlushAudioLoopForTesting(); |
| - |
| - bool is_recording_; |
| - |
| - media::AudioInputStream* stream_; |
| - DecodeSamplesCallback decode_callback_; |
| - |
| - // ProvideInput will use this buffer as its source. |
| - const media::AudioBus* temp_conversion_buffer_; |
| - |
| - // Outside of the ctor/Initialize method, only access the next variables on |
| - // the recording thread. |
| - scoped_ptr<media::AudioBus> buffer_; |
| - int total_buffer_frames_; |
| - int buffer_frame_index_; |
| - |
| - scoped_ptr<media::AudioConverter> converter_; |
| - |
| - scoped_ptr<media::AudioInputStream> input_stream_for_testing_; |
| - scoped_ptr<media::AudioParameters> params_for_testing_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(AudioRecorder); |
| + virtual ~AudioRecorder(){}; |
|
Daniel Erat
2014/10/22 16:34:35
nit:
virtual ~AudioRecorder() {}
rkc
2014/10/22 18:21:48
git-cl-format is doing this automatically for some
Daniel Erat
2014/10/22 18:32:40
cool, thanks. does that run clang_format.py intern
rkc
2014/10/22 19:28:46
Yep. Usually it is a significant convenience; unfo
|
| }; |
| } // namespace copresence |