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

Unified Diff: components/copresence/mediums/audio/audio_recorder.h

Issue 461803003: Stop playing/recording when not needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
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 69e95a1db2d3592172e4d4a50eb7df54a108631d..53ee4b0b6be1c3f2eab4b23f20de7450dc89e12b 100644
--- a/components/copresence/mediums/audio/audio_recorder.h
+++ b/components/copresence/mediums/audio/audio_recorder.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_
-#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_
+#ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_H_
+#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_H_
#include <string>
@@ -33,13 +33,15 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
explicit AudioRecorder(const DecodeSamplesCallback& decode_callback);
// Initializes the object. Do not use this object before calling this method.
- void Initialize();
+ virtual void Initialize();
- void Record();
- void Stop();
+ virtual void Record();
+ virtual void Stop();
+
+ virtual bool IsRecording();
xiyuan 2014/08/12 18:57:51 ditto
rkc 2014/08/13 00:29:00 Done.
// Cleans up and deletes this object. Do not use object after this call.
- void Finalize();
+ virtual void Finalize();
// Takes ownership of the stream.
void set_input_stream_for_testing(
@@ -52,13 +54,16 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
params_for_testing_.reset(params_for_testing);
}
+ protected:
+ virtual ~AudioRecorder();
+
+ bool is_recording_;
xiyuan 2014/08/12 18:57:51 ditto
rkc 2014/08/13 00:29:00 Done.
+
private:
friend class AudioRecorderTest;
FRIEND_TEST_ALL_PREFIXES(AudioRecorderTest, BasicRecordAndStop);
FRIEND_TEST_ALL_PREFIXES(AudioRecorderTest, OutOfOrderRecordAndStopMultiple);
- virtual ~AudioRecorder();
-
// Methods to do our various operations; all of these need to be run on the
// audio thread.
void InitializeOnAudioThread();
@@ -86,7 +91,6 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
void FlushAudioLoopForTesting();
media::AudioInputStream* stream_;
- bool is_recording_;
DecodeSamplesCallback decode_callback_;
// ProvideInput will use this buffer as its source.
@@ -108,4 +112,4 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
} // namespace copresence
-#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_
+#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_H_

Powered by Google App Engine
This is Rietveld 408576698