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

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 15979015: Reland 15721002: Hook up the device selection to the WebAudio live audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the comments. Created 7 years, 7 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/renderer_webkitplatformsupport_impl.cc
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 4efc1fa9db333d72e46c3b714c628a4ebd3f3a76..f0b7910047578506c39673deea1959612239f363 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -10,6 +10,7 @@
#include "base/metrics/histogram.h"
#include "base/platform_file.h"
#include "base/shared_memory.h"
+#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "content/common/database_util.h"
#include "content/common/file_utilities_messages.h"
@@ -681,16 +682,6 @@ RendererWebKitPlatformSupportImpl::createAudioDevice(
double sample_rate,
WebAudioDevice::RenderCallback* callback,
const WebKit::WebString& input_device_id) {
- if (input_device_id != "default") {
- // Only allow audio input if we know for sure that WebKit is giving us the
- // "default" input device.
- // TODO(crogers): add support for non-default audio input devices when
- // using synchronized audio I/O in WebAudio.
- if (input_channels > 0)
- DLOG(WARNING) << "createAudioDevice(): request for audio input ignored";
- input_channels = 0;
- }
-
// The |channels| does not exactly identify the channel layout of the
// device. The switch statement below assigns a best guess to the channel
// layout based on number of channels.
@@ -726,12 +717,21 @@ RendererWebKitPlatformSupportImpl::createAudioDevice(
layout = media::CHANNEL_LAYOUT_STEREO;
}
+ int session_id = 0;
+ if (input_device_id.isNull() ||
+ !base::StringToInt(UTF16ToUTF8(input_device_id), &session_id)) {
+ if (input_channels > 0)
+ DLOG(WARNING) << "createAudioDevice(): request for audio input ignored";
+
+ input_channels = 0;
+ }
+
media::AudioParameters params(
media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
layout, input_channels,
static_cast<int>(sample_rate), 16, buffer_size);
- return new RendererWebAudioDeviceImpl(params, callback);
+ return new RendererWebAudioDeviceImpl(params, callback, session_id);
}
//------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698