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

Unified Diff: content/renderer/media/webrtc_audio_renderer.cc

Issue 11880009: Introduce AudioHardwareConfig for renderer side audio device info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style nits. Created 7 years, 11 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/renderer/media/webrtc_audio_renderer.cc
diff --git a/content/renderer/media/webrtc_audio_renderer.cc b/content/renderer/media/webrtc_audio_renderer.cc
index c21c6624869c6187e18b9d6a46c71e7a7f7874bb..0d3371360dc146c8fb932f10c59b56511055cac8 100644
--- a/content/renderer/media/webrtc_audio_renderer.cc
+++ b/content/renderer/media/webrtc_audio_renderer.cc
@@ -8,11 +8,13 @@
#include "base/metrics/histogram.h"
#include "base/string_util.h"
#include "content/renderer/media/audio_device_factory.h"
-#include "content/renderer/media/audio_hardware.h"
#include "content/renderer/media/renderer_audio_output_device.h"
#include "content/renderer/media/webrtc_audio_device_impl.h"
+#include "content/renderer/render_thread_impl.h"
#include "media/audio/audio_util.h"
#include "media/audio/sample_rates.h"
+#include "media/base/audio_hardware_config.h"
+
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "media/audio/win/core_audio_util_win.h"
@@ -24,10 +26,10 @@ namespace {
// Supported hardware sample rates for output sides.
#if defined(OS_WIN) || defined(OS_MACOSX)
-// media::GetAudioOutputHardwareSampleRate() asks the audio layer
-// for its current sample rate (set by the user) on Windows and Mac OS X.
-// The listed rates below adds restrictions and Initialize()
-// will fail if the user selects any rate outside these ranges.
+// AudioHardwareConfig::GetOutputSampleRate() asks the audio layer for its
+// current sample rate (set by the user) on Windows and Mac OS X. The listed
+// rates below adds restrictions and Initialize() will fail if the user selects
+// any rate outside these ranges.
int kValidOutputRates[] = {96000, 48000, 44100};
#elif defined(OS_LINUX) || defined(OS_OPENBSD)
int kValidOutputRates[] = {48000, 44100};
@@ -104,9 +106,10 @@ bool WebRtcAudioRenderer::Initialize(WebRtcAudioRendererSource* source) {
sink_ = AudioDeviceFactory::NewOutputDevice();
DCHECK(sink_);
- // Ask the browser for the default audio output hardware sample-rate.
- // This request is based on a synchronous IPC message.
- int sample_rate = GetAudioOutputSampleRate();
+ // Ask the renderer for the default audio output hardware sample-rate.
+ media::AudioHardwareConfig* hardware_config =
+ RenderThreadImpl::current()->GetAudioHardwareConfig();
+ int sample_rate = hardware_config->GetOutputSampleRate();
DVLOG(1) << "Audio output hardware sample rate: " << sample_rate;
UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioOutputSampleRate",
sample_rate, media::kUnexpectedAudioSampleRate);
« no previous file with comments | « content/renderer/media/webrtc_audio_device_unittest.cc ('k') | content/renderer/pepper/pepper_platform_audio_output_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698