Diff
Modified: trunk/Source/Platform/ChangeLog (143780 => 143781)
--- trunk/Source/Platform/ChangeLog 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/Platform/ChangeLog 2013-02-22 20:49:16 UTC (rev 143781)
@@ -1,3 +1,13 @@
+2013-02-22 Chris Rogers <[email protected]>
+
+ AudioDestination::create() needs extra device identification information for live/local input streams
+ https://bugs.webkit.org/show_bug.cgi?id=109494
+
+ Reviewed by James Robinson.
+
+ * chromium/public/WebMediaStreamSource.h:
+ (WebMediaStreamSource):
+
2013-02-21 James Robinson <[email protected]>
[chromium] Remove deprecated WebCompositorSupport::createLayerTreeView() declaration
Modified: trunk/Source/Platform/chromium/public/WebMediaStreamSource.h (143780 => 143781)
--- trunk/Source/Platform/chromium/public/WebMediaStreamSource.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/Platform/chromium/public/WebMediaStreamSource.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -92,6 +92,9 @@
WEBKIT_EXPORT ExtraData* extraData() const;
WEBKIT_EXPORT void setExtraData(ExtraData*);
+ WEBKIT_EXPORT WebString deviceId() const;
+ WEBKIT_EXPORT void setDeviceId(const WebString&);
+
// Only used if if this is a WebAudio source.
// The WebAudioDestinationConsumer is not owned, and has to be disposed of separately
// after calling removeAudioConsumer.
Modified: trunk/Source/WebCore/ChangeLog (143780 => 143781)
--- trunk/Source/WebCore/ChangeLog 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/ChangeLog 2013-02-22 20:49:16 UTC (rev 143781)
@@ -1,3 +1,46 @@
+2013-02-22 Chris Rogers <[email protected]>
+
+ AudioDestination::create() needs extra device identification information for live/local input streams
+ https://bugs.webkit.org/show_bug.cgi?id=109494
+
+ Reviewed by James Robinson.
+
+ AudioDestination::create() supports live/local audio input. But, since there may be multiple
+ audio input devices available, an identifier for the requested input device needs to be
+ passed in. The embedder may then use this information so that the proper audio hardware is
+ accessed.
+
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::createMediaStreamSource):
+ * Modules/webaudio/AudioDestinationNode.h:
+ (AudioDestinationNode):
+ * Modules/webaudio/DefaultAudioDestinationNode.cpp:
+ (WebCore::DefaultAudioDestinationNode::initialize):
+ (WebCore::DefaultAudioDestinationNode::createDestination):
+ (WebCore::DefaultAudioDestinationNode::enableInput):
+ * Modules/webaudio/DefaultAudioDestinationNode.h:
+ (DefaultAudioDestinationNode):
+ * Modules/webaudio/OfflineAudioDestinationNode.h:
+ * platform/audio/AudioDestination.h:
+ (AudioDestination):
+ * platform/audio/chromium/AudioDestinationChromium.cpp:
+ (WebCore::AudioDestination::create):
+ (WebCore::AudioDestinationChromium::AudioDestinationChromium):
+ * platform/audio/chromium/AudioDestinationChromium.h:
+ (AudioDestinationChromium):
+ * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
+ (WebCore::AudioDestination::create):
+ * platform/audio/mac/AudioDestinationMac.cpp:
+ (WebCore::AudioDestination::create):
+ * platform/chromium/support/WebMediaStreamSource.cpp:
+ (WebKit::WebMediaStreamSource::deviceId):
+ (WebKit):
+ (WebKit::WebMediaStreamSource::setDeviceId):
+ * platform/mediastream/MediaStreamSource.h:
+ (WebCore::MediaStreamSource::deviceId):
+ (WebCore::MediaStreamSource::setDeviceId):
+ (MediaStreamSource):
+
2013-02-22 Ryosuke Niwa <[email protected]>
Binding tests rebaseline after r143737.
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (143780 => 143781)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2013-02-22 20:49:16 UTC (rev 143781)
@@ -395,9 +395,13 @@
AudioSourceProvider* provider = 0;
- if (mediaStream->isLocal() && mediaStream->getAudioTracks().size()) {
+ MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks();
+ if (mediaStream->isLocal() && audioTracks.size()) {
+ // Enable input for the specific local audio device specified in the MediaStreamSource.
+ RefPtr<MediaStreamTrack> localAudio = audioTracks[0];
+ MediaStreamSource* source = localAudio->component()->source();
+ destination()->enableInput(source->deviceId());
provider = destination()->localAudioInputProvider();
- destination()->enableInput();
} else {
// FIXME: get a provider for non-local MediaStreams (like from a remote peer).
provider = 0;
Modified: trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h (143780 => 143781)
--- trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -54,7 +54,9 @@
virtual unsigned numberOfChannels() const { return 2; } // FIXME: update when multi-channel (more than stereo) is supported
- virtual void enableInput() = 0;
+ // Enable local/live input for the specified device.
+ virtual void enableInput(const String& inputDeviceId) = 0;
+
virtual void startRendering() = 0;
AudioSourceProvider* localAudioInputProvider() { return &m_localAudioInputProvider; }
Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp (143780 => 143781)
--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp 2013-02-22 20:49:16 UTC (rev 143781)
@@ -52,7 +52,7 @@
if (isInitialized())
return;
- createDestination();
+ createDestination(String());
AudioNode::initialize();
}
@@ -68,23 +68,24 @@
AudioNode::uninitialize();
}
-void DefaultAudioDestinationNode::createDestination()
+void DefaultAudioDestinationNode::createDestination(const String& inputDeviceId)
{
float hardwareSampleRate = AudioDestination::hardwareSampleRate();
LOG(WebAudio, ">>>> hardwareSampleRate = %f\n", hardwareSampleRate);
- m_destination = AudioDestination::create(*this, m_numberOfInputChannels, numberOfChannels(), hardwareSampleRate);
+ m_destination = AudioDestination::create(*this, inputDeviceId, m_numberOfInputChannels, numberOfChannels(), hardwareSampleRate);
}
-void DefaultAudioDestinationNode::enableInput()
+void DefaultAudioDestinationNode::enableInput(const String& inputDeviceId)
{
- ASSERT(isMainThread());
+ ASSERT(isMainThread());
if (m_numberOfInputChannels != EnabledInputChannels) {
m_numberOfInputChannels = EnabledInputChannels;
if (isInitialized()) {
+ // Re-create destination.
m_destination->stop();
- createDestination();
+ createDestination(inputDeviceId);
m_destination->start();
}
}
Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h (143780 => 143781)
--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -47,12 +47,12 @@
virtual void uninitialize() OVERRIDE;
// AudioDestinationNode
- virtual void enableInput() OVERRIDE;
+ virtual void enableInput(const String& inputDeviceId) OVERRIDE;
virtual void startRendering() OVERRIDE;
private:
explicit DefaultAudioDestinationNode(AudioContext*);
- void createDestination();
+ void createDestination(const String& inputDeviceId);
OwnPtr<AudioDestination> m_destination;
unsigned m_numberOfInputChannels;
Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h (143780 => 143781)
--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -50,7 +50,7 @@
virtual void uninitialize() OVERRIDE;
// AudioDestinationNode
- virtual void enableInput() OVERRIDE { };
+ virtual void enableInput(const String&) OVERRIDE { }
virtual void startRendering() OVERRIDE;
virtual float sampleRate() const { return m_renderTarget->sampleRate(); }
Modified: trunk/Source/WebCore/platform/audio/AudioDestination.h (143780 => 143781)
--- trunk/Source/WebCore/platform/audio/AudioDestination.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/audio/AudioDestination.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -31,6 +31,7 @@
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
+#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -43,7 +44,8 @@
class AudioDestination {
public:
// Pass in (numberOfInputChannels > 0) if live/local audio input is desired.
- static PassOwnPtr<AudioDestination> create(AudioIOCallback&, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
+ // Port-specific device identification information for live/local input streams can be passed in the inputDeviceId.
+ static PassOwnPtr<AudioDestination> create(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
virtual ~AudioDestination() { }
Modified: trunk/Source/WebCore/platform/audio/chromium/AudioDestinationChromium.cpp (143780 => 143781)
--- trunk/Source/WebCore/platform/audio/chromium/AudioDestinationChromium.cpp 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/audio/chromium/AudioDestinationChromium.cpp 2013-02-22 20:49:16 UTC (rev 143781)
@@ -45,12 +45,12 @@
const size_t fifoSize = 8192;
// Factory method: Chromium-implementation
-PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
+PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
{
- return adoptPtr(new AudioDestinationChromium(callback, numberOfInputChannels, numberOfOutputChannels, sampleRate));
+ return adoptPtr(new AudioDestinationChromium(callback, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate));
}
-AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
+AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
: m_callback(callback)
, m_numberOfOutputChannels(numberOfOutputChannels)
, m_inputBus(numberOfInputChannels, renderBufferSize)
@@ -66,6 +66,7 @@
if (m_callbackBufferSize + renderBufferSize > fifoSize)
return;
+ // FIXME: switch over to new method using inputDeviceId, once chromium supports it.
m_audioDevice = adoptPtr(WebKit::Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this));
ASSERT(m_audioDevice);
Modified: trunk/Source/WebCore/platform/audio/chromium/AudioDestinationChromium.h (143780 => 143781)
--- trunk/Source/WebCore/platform/audio/chromium/AudioDestinationChromium.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/audio/chromium/AudioDestinationChromium.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -45,7 +45,7 @@
class AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback, public AudioSourceProvider {
public:
- AudioDestinationChromium(AudioIOCallback&, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
+ AudioDestinationChromium(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
virtual ~AudioDestinationChromium();
virtual void start();
Modified: trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp (143780 => 143781)
--- trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp 2013-02-22 20:49:16 UTC (rev 143781)
@@ -43,8 +43,10 @@
return destination->handleMessage(message);
}
-PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
+PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String&, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
{
+ // FIXME: make use of inputDeviceId as appropriate.
+
// FIXME: Add support for local/live audio input.
if (numberOfInputChannels)
LOG(Media, "AudioDestination::create(%u, %u, %f) - unhandled input channels", numberOfInputChannels, numberOfOutputChannels, sampleRate);
Modified: trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp (143780 => 143781)
--- trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp 2013-02-22 20:49:16 UTC (rev 143781)
@@ -45,8 +45,10 @@
const float kHighThreshold = 1;
// Factory method: Mac-implementation
-PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
+PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String&, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
{
+ // FIXME: make use of inputDeviceId as appropriate.
+
// FIXME: Add support for local/live audio input.
if (numberOfInputChannels)
LOG(Media, "AudioDestination::create(%u, %u, %f) - unhandled input channels", numberOfInputChannels, numberOfOutputChannels, sampleRate);
Modified: trunk/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp (143780 => 143781)
--- trunk/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/chromium/support/WebMediaStreamSource.cpp 2013-02-22 20:49:16 UTC (rev 143781)
@@ -141,6 +141,18 @@
m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData)));
}
+WebString WebMediaStreamSource::deviceId() const
+{
+ ASSERT(!m_private.isNull());
+ return m_private->deviceId();
+}
+
+void WebMediaStreamSource::setDeviceId(const WebString& deviceId)
+{
+ ASSERT(!m_private.isNull());
+ m_private->setDeviceId(deviceId);
+}
+
bool WebMediaStreamSource::requiresAudioConsumer() const
{
ASSERT(!m_private.isNull());
Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamSource.h (143780 => 143781)
--- trunk/Source/WebCore/platform/mediastream/MediaStreamSource.h 2013-02-22 20:44:17 UTC (rev 143780)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamSource.h 2013-02-22 20:49:16 UTC (rev 143781)
@@ -80,6 +80,9 @@
PassRefPtr<ExtraData> extraData() const { return m_extraData; }
void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
+ const String& deviceId() { return m_deviceId; }
+ void setDeviceId(const String& deviceId) { m_deviceId = deviceId; }
+
void setAudioFormat(size_t numberOfChannels, float sampleRate);
void consumeAudio(AudioBus*, size_t numberOfFrames);
@@ -95,6 +98,7 @@
Type m_type;
String m_name;
ReadyState m_readyState;
+ String m_deviceId;
bool m_requiresConsumer;
Vector<Observer*> m_observers;
Mutex m_audioConsumersLock;