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

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

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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.cc
diff --git a/components/copresence/mediums/audio/audio_recorder.cc b/components/copresence/mediums/audio/audio_recorder.cc
index 0946ba86bf80cf4caa0526277bd617993523d180..4d36651c4c0cc7c0580163eb9d8e3c55ce371177 100644
--- a/components/copresence/mediums/audio/audio_recorder.cc
+++ b/components/copresence/mediums/audio/audio_recorder.cc
@@ -39,7 +39,7 @@ void AudioBusToString(scoped_ptr<media::AudioBus> source, std::string* buffer) {
// converts our samples to the required sample rate, interleaves the samples
// and sends them to the whispernet decoder to process.
void ProcessSamples(scoped_ptr<media::AudioBus> bus,
- const AudioRecorder::DecodeSamplesCallback& callback) {
+ const AudioRecorder::RecordedSamplesCallback& callback) {
std::string samples;
AudioBusToString(bus.Pass(), &samples);
content::BrowserThread::PostTask(
@@ -50,15 +50,16 @@ void ProcessSamples(scoped_ptr<media::AudioBus> bus,
// Public methods.
-AudioRecorder::AudioRecorder(const DecodeSamplesCallback& decode_callback)
+AudioRecorder::AudioRecorder()
: is_recording_(false),
stream_(NULL),
- decode_callback_(decode_callback),
+ temp_conversion_buffer_(NULL),
total_buffer_frames_(0),
buffer_frame_index_(0) {
}
-void AudioRecorder::Initialize() {
+void AudioRecorder::Initialize(const RecordedSamplesCallback& decode_callback) {
+ decode_callback_ = decode_callback;
media::AudioManager::Get()->GetTaskRunner()->PostTask(
FROM_HERE,
base::Bind(&AudioRecorder::InitializeOnAudioThread,

Powered by Google App Engine
This is Rietveld 408576698