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

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..eec982d4e040c59bc6ad9b1125f2ff54a4643854 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();
// Cleans up and deletes this object. Do not use object after this call.
- void Finalize();
+ virtual void Finalize();
+
+ bool IsRecording();
// Takes ownership of the stream.
void set_input_stream_for_testing(
@@ -52,13 +54,15 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
params_for_testing_.reset(params_for_testing);
}
+ 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);
- virtual ~AudioRecorder();
-
// Methods to do our various operations; all of these need to be run on the
// audio thread.
void InitializeOnAudioThread();
@@ -85,8 +89,9 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
// performed.
void FlushAudioLoopForTesting();
- media::AudioInputStream* stream_;
bool is_recording_;
+
+ media::AudioInputStream* stream_;
DecodeSamplesCallback decode_callback_;
// ProvideInput will use this buffer as its source.
@@ -108,4 +113,4 @@ class AudioRecorder : public media::AudioInputStream::AudioInputCallback,
} // namespace copresence
-#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_
+#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_RECORDER_H_
« no previous file with comments | « components/copresence/mediums/audio/audio_player.cc ('k') | components/copresence/mediums/audio/audio_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698