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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 12316131: Moved AudioUtil static functions to AudioManager interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: made the GetPreferredOutputStreamParameters protected Created 7 years, 10 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: content/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index e94286aa08b82c6287f522b1b6e4f6befea56e95..608c7ed946cf52cc8a2238ffd98a916c8276e243 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -16,6 +16,7 @@
#include "base/threading/thread.h"
#include "base/threading/worker_pool.h"
#include "base/utf_string_conversions.h"
+#include "content/browser/browser_main_loop.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/dom_storage/dom_storage_context_impl.h"
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
@@ -45,8 +46,9 @@
#include "content/public/common/url_constants.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_platform_file.h"
+#include "media/audio/audio_manager.h"
#include "media/audio/audio_manager_base.h"
-#include "media/audio/audio_util.h"
+#include "media/audio/audio_parameters.h"
#include "media/base/media_log_event.h"
#include "net/base/io_buffer.h"
#include "net/base/keygen_handler.h"
@@ -776,17 +778,22 @@ void RenderMessageFilter::OnGetCPUUsage(int* cpu_usage) {
*cpu_usage = cpu_usage_;
}
+// TODO(xians): refactor the API to return input and output AudioParameters.
void RenderMessageFilter::OnGetAudioHardwareConfig(
int* output_buffer_size, int* output_sample_rate, int* input_sample_rate,
media::ChannelLayout* input_channel_layout) {
- *output_buffer_size = media::GetAudioHardwareBufferSize();
- *output_sample_rate = media::GetAudioHardwareSampleRate();
+ media::AudioManager* audio_manager = BrowserMainLoop::GetAudioManager();
+ const media::AudioParameters output_parameters =
+ audio_manager->GetDefaultOutputStreamParameters();
+ *output_buffer_size = output_parameters.frames_per_buffer();
+ *output_sample_rate = output_parameters.sample_rate();
// TODO(henrika): add support for all available input devices.
- *input_sample_rate = media::GetAudioInputHardwareSampleRate(
- media::AudioManagerBase::kDefaultDeviceId);
- *input_channel_layout = media::GetAudioInputHardwareChannelLayout(
- media::AudioManagerBase::kDefaultDeviceId);
+ const media::AudioParameters input_parameters =
+ audio_manager->GetInputStreamParameters(
+ media::AudioManagerBase::kDefaultDeviceId);
+ *input_sample_rate = input_parameters.sample_rate();
+ *input_channel_layout = input_parameters.channel_layout();
}
void RenderMessageFilter::OnGetMonitorColorProfile(std::vector<char>* profile) {
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.cc ('k') | content/renderer/media/webrtc_audio_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698