| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/audio_modem/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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "components/copresence/public/copresence_constants.h" | 15 #include "components/audio_modem/public/audio_modem_types.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "media/audio/audio_manager.h" | 17 #include "media/audio/audio_manager.h" |
| 18 #include "media/audio/audio_manager_base.h" | 18 #include "media/audio/audio_manager_base.h" |
| 19 #include "media/base/audio_bus.h" | 19 #include "media/base/audio_bus.h" |
| 20 | 20 |
| 21 namespace copresence { | 21 namespace audio_modem { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 const float kProcessIntervalMs = 500.0f; // milliseconds. | 25 const float kProcessIntervalMs = 500.0f; // milliseconds. |
| 26 | 26 |
| 27 void AudioBusToString(scoped_ptr<media::AudioBus> source, std::string* buffer) { | 27 void AudioBusToString(scoped_ptr<media::AudioBus> source, std::string* buffer) { |
| 28 buffer->resize(source->frames() * source->channels() * sizeof(float)); | 28 buffer->resize(source->frames() * source->channels() * sizeof(float)); |
| 29 float* buffer_view = reinterpret_cast<float*>(string_as_array(buffer)); | 29 float* buffer_view = reinterpret_cast<float*>(string_as_array(buffer)); |
| 30 | 30 |
| 31 const int channels = source->channels(); | 31 const int channels = source->channels(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 base::RunLoop rl; | 245 base::RunLoop rl; |
| 246 media::AudioManager::Get()->GetTaskRunner()->PostTaskAndReply( | 246 media::AudioManager::Get()->GetTaskRunner()->PostTaskAndReply( |
| 247 FROM_HERE, | 247 FROM_HERE, |
| 248 base::Bind( | 248 base::Bind( |
| 249 base::IgnoreResult(&AudioRecorderImpl::FlushAudioLoopForTesting), | 249 base::IgnoreResult(&AudioRecorderImpl::FlushAudioLoopForTesting), |
| 250 base::Unretained(this)), | 250 base::Unretained(this)), |
| 251 rl.QuitClosure()); | 251 rl.QuitClosure()); |
| 252 rl.Run(); | 252 rl.Run(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace copresence | 255 } // namespace audio_modem |
| OLD | NEW |