| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/copresence/mediums/audio/audio_recorder_impl.h" | 5 #include "components/copresence/mediums/audio/audio_recorder_impl.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 137     return; | 137     return; | 
| 138   } | 138   } | 
| 139   stream_->SetVolume(stream_->GetMaxVolume()); | 139   stream_->SetVolume(stream_->GetMaxVolume()); | 
| 140 } | 140 } | 
| 141 | 141 | 
| 142 void AudioRecorderImpl::RecordOnAudioThread() { | 142 void AudioRecorderImpl::RecordOnAudioThread() { | 
| 143   DCHECK(media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 143   DCHECK(media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 
| 144   if (!stream_ || is_recording_) | 144   if (!stream_ || is_recording_) | 
| 145     return; | 145     return; | 
| 146 | 146 | 
|  | 147   VLOG(3) << "Starting recording."; | 
| 147   converter_->Reset(); | 148   converter_->Reset(); | 
| 148   stream_->Start(this); | 149   stream_->Start(this); | 
| 149   is_recording_ = true; | 150   is_recording_ = true; | 
| 150 } | 151 } | 
| 151 | 152 | 
| 152 void AudioRecorderImpl::StopOnAudioThread() { | 153 void AudioRecorderImpl::StopOnAudioThread() { | 
| 153   DCHECK(media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 154   DCHECK(media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 
| 154   if (!stream_ || !is_recording_) | 155   if (!stream_ || !is_recording_) | 
| 155     return; | 156     return; | 
| 156 | 157 | 
|  | 158   VLOG(3) << "Stopping recording."; | 
| 157   stream_->Stop(); | 159   stream_->Stop(); | 
| 158   is_recording_ = false; | 160   is_recording_ = false; | 
| 159 } | 161 } | 
| 160 | 162 | 
| 161 void AudioRecorderImpl::StopAndCloseOnAudioThread() { | 163 void AudioRecorderImpl::StopAndCloseOnAudioThread() { | 
| 162   DCHECK(media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 164   DCHECK(media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 
| 163   if (!stream_) | 165   if (!stream_) | 
| 164     return; | 166     return; | 
| 165 | 167 | 
| 166   StopOnAudioThread(); | 168   StopOnAudioThread(); | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 248   media::AudioManager::Get()->GetTaskRunner()->PostTaskAndReply( | 250   media::AudioManager::Get()->GetTaskRunner()->PostTaskAndReply( | 
| 249       FROM_HERE, | 251       FROM_HERE, | 
| 250       base::Bind( | 252       base::Bind( | 
| 251           base::IgnoreResult(&AudioRecorderImpl::FlushAudioLoopForTesting), | 253           base::IgnoreResult(&AudioRecorderImpl::FlushAudioLoopForTesting), | 
| 252           base::Unretained(this)), | 254           base::Unretained(this)), | 
| 253       rl.QuitClosure()); | 255       rl.QuitClosure()); | 
| 254   rl.Run(); | 256   rl.Run(); | 
| 255 } | 257 } | 
| 256 | 258 | 
| 257 }  // namespace copresence | 259 }  // namespace copresence | 
| OLD | NEW | 
|---|