[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
crogers at google.com
crogers at google.com
Fri Jan 21 14:59:25 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit bf85fc5348eef6e86faa94c12bc549095b269c23
Author: crogers at google.com <crogers at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 6 00:37:10 2011 +0000
2011-01-05 Chris Rogers <crogers at google.com>
Reviewed by Darin Fisher.
Add WebKitClient::createAudioDevice() for Chromium port of web audio API
https://bugs.webkit.org/show_bug.cgi?id=51424
* WebKit.gyp:
* public/WebAudioDevice.h: Added.
(WebKit::WebAudioDevice::RenderCallback::~RenderCallback):
(WebKit::WebAudioDevice::~WebAudioDevice):
* public/WebKitClient.h:
(WebKit::WebKitClient::createAudioDevice):
* src/AudioDestinationChromium.cpp: Added.
(WebCore::AudioDestination::create):
(WebCore::AudioDestinationChromium::AudioDestinationChromium):
(WebCore::AudioDestinationChromium::~AudioDestinationChromium):
(WebCore::AudioDestinationChromium::start):
(WebCore::AudioDestinationChromium::stop):
(WebCore::AudioDestination::hardwareSampleRate):
(WebCore::AudioDestinationChromium::render):
* src/AudioDestinationChromium.h: Added.
(WebCore::AudioDestinationChromium::isPlaying):
(WebCore::AudioDestinationChromium::sampleRate):
2011-01-05 Chris Rogers <crogers at google.com>
Reviewed by Darin Fisher.
Add WebKitClient::createAudioDevice() for Chromium port of web audio API
https://bugs.webkit.org/show_bug.cgi?id=51424
No new tests since audio API is not yet implemented.
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dc2abf2..a71a7c8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-05 Chris Rogers <crogers at google.com>
+
+ Reviewed by Darin Fisher.
+
+ Add WebKitClient::createAudioDevice() for Chromium port of web audio API
+ https://bugs.webkit.org/show_bug.cgi?id=51424
+
+ No new tests since audio API is not yet implemented.
+
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+
2011-01-05 Anders Carlsson <andersca at apple.com>
Try again.
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index c936793..4db6c8c 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -1149,11 +1149,9 @@
['include', 'platform/(graphics/)?mac/[^/]*Font[^/]*\\.(cpp|mm?)$'],
['include', 'platform/graphics/mac/ComplexText[^/]*\\.(cpp|h)$'],
- # Necessary for web audio API bringup on Chrome.
- # They will later be replaced with chromium-specific code.
+ # AudioBusMac is necessary for web audio API bringup on Chrome.
+ # It will later be replaced with chromium-specific code.
['include', 'platform/audio/mac/AudioBusMac\\.mm$'],
- ['include', 'platform/audio/mac/AudioDestinationMac\\.cpp$'],
- ['include', 'platform/audio/mac/AudioFileReaderMac\\.cpp$'],
['include', 'platform/audio/mac/FFTFrameMac\\.cpp$'],
# Cherry-pick some files that can't be included by broader regexps.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 806ab95..6a519fb 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -2429,6 +2429,7 @@
'platform/audio/ReverbInputBuffer.cpp',
'platform/audio/VectorMath.h',
'platform/audio/VectorMath.cpp',
+ 'platform/audio/chromium/AudioBusChromium.cpp',
'platform/audio/mac/AudioBusMac.mm',
'platform/audio/mac/AudioDestinationMac.h',
'platform/audio/mac/AudioDestinationMac.cpp',
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 0f2d0ba..362b51e 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-05 Chris Rogers <crogers at google.com>
+
+ Reviewed by Darin Fisher.
+
+ Add WebKitClient::createAudioDevice() for Chromium port of web audio API
+ https://bugs.webkit.org/show_bug.cgi?id=51424
+
+ * WebKit.gyp:
+ * public/WebAudioDevice.h: Added.
+ (WebKit::WebAudioDevice::RenderCallback::~RenderCallback):
+ (WebKit::WebAudioDevice::~WebAudioDevice):
+ * public/WebKitClient.h:
+ (WebKit::WebKitClient::createAudioDevice):
+ * src/AudioDestinationChromium.cpp: Added.
+ (WebCore::AudioDestination::create):
+ (WebCore::AudioDestinationChromium::AudioDestinationChromium):
+ (WebCore::AudioDestinationChromium::~AudioDestinationChromium):
+ (WebCore::AudioDestinationChromium::start):
+ (WebCore::AudioDestinationChromium::stop):
+ (WebCore::AudioDestination::hardwareSampleRate):
+ (WebCore::AudioDestinationChromium::render):
+ * src/AudioDestinationChromium.h: Added.
+ (WebCore::AudioDestinationChromium::isPlaying):
+ (WebCore::AudioDestinationChromium::sampleRate):
+
2011-01-05 David Levin <levin at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index de39ac3..17ab254 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -111,6 +111,7 @@
'public/WebApplicationCacheHostClient.h',
'public/WebAttribute.h',
'public/WebAudioBus.h',
+ 'public/WebAudioDevice.h',
'public/WebBindings.h',
'public/WebBlobData.h',
'public/WebBlobRegistry.h',
@@ -304,6 +305,8 @@
'src/AsyncFileSystemChromium.h',
'src/AsyncFileWriterChromium.cpp',
'src/AsyncFileWriterChromium.h',
+ 'src/AudioDestinationChromium.cpp',
+ 'src/AudioDestinationChromium.h',
'src/AutoFillPopupMenuClient.cpp',
'src/AutoFillPopupMenuClient.h',
'src/BackForwardListClientImpl.cpp',
diff --git a/WebKit/chromium/public/WebAudioDevice.h b/WebKit/chromium/public/WebAudioDevice.h
new file mode 100644
index 0000000..a9f5a1c
--- /dev/null
+++ b/WebKit/chromium/public/WebAudioDevice.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebAudioDevice_h
+#define WebAudioDevice_h
+
+#include "WebVector.h"
+
+namespace WebKit {
+
+// Abstract interface to the Chromium audio system.
+
+class WebAudioDevice {
+public:
+ class RenderCallback {
+ public:
+ virtual void render(const WebVector<float*>& audioData, size_t numberOfFrames) = 0;
+ protected:
+ virtual ~RenderCallback() { }
+ };
+
+ virtual ~WebAudioDevice() { }
+
+ virtual void start() = 0;
+ virtual void stop() = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebAudioDevice_h
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index bf9a97b..ae7892d 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -32,6 +32,7 @@
#define WebKitClient_h
#include "WebAudioBus.h"
+#include "WebAudioDevice.h"
#include "WebCommon.h"
#include "WebData.h"
#include "WebLocalizedString.h"
@@ -277,6 +278,10 @@ public:
// Returns newly allocated WebGraphicsContext3D instance.
virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; }
+ // Audio --------------------------------------------------------------
+
+ virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*) { return 0; }
+
// FileSystem ----------------------------------------------------------
// Must return non-null.
diff --git a/WebKit/chromium/src/AudioDestinationChromium.cpp b/WebKit/chromium/src/AudioDestinationChromium.cpp
new file mode 100644
index 0000000..bed2562
--- /dev/null
+++ b/WebKit/chromium/src/AudioDestinationChromium.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#include "AudioDestinationChromium.h"
+
+#include "AudioSourceProvider.h"
+#include "WebKit.h"
+#include "WebKitClient.h"
+
+using namespace WebKit;
+
+namespace WebCore {
+
+// Buffer size that the Chromium audio system will call us back with.
+// This value may need to be tuned based on the OS.
+// FIXME: It may be possible to reduce this value once real-time threads
+// and other Chromium audio improvements are made.
+const unsigned callbackBufferSize = 2048;
+
+// Buffer size at which the web audio engine will render.
+const unsigned renderBufferSize = 128;
+
+const unsigned renderCountPerCallback = callbackBufferSize / renderBufferSize;
+
+// FIXME: add support for multi-channel.
+const unsigned numberOfChannels = 2;
+
+// Factory method: Chromium-implementation
+PassOwnPtr<AudioDestination> AudioDestination::create(AudioSourceProvider& provider, double sampleRate)
+{
+ return adoptPtr(new AudioDestinationChromium(provider, sampleRate));
+}
+
+AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider, double sampleRate)
+ : m_provider(provider)
+ , m_renderBus(numberOfChannels, renderBufferSize, false)
+ , m_sampleRate(sampleRate)
+ , m_isPlaying(false)
+{
+ m_audioDevice = adoptPtr(webKitClient()->createAudioDevice(callbackBufferSize, numberOfChannels, sampleRate, this));
+ ASSERT(m_audioDevice.get());
+}
+
+AudioDestinationChromium::~AudioDestinationChromium()
+{
+ stop();
+}
+
+void AudioDestinationChromium::start()
+{
+ if (!m_isPlaying && m_audioDevice.get()) {
+ m_audioDevice->start();
+ m_isPlaying = true;
+ }
+}
+
+void AudioDestinationChromium::stop()
+{
+ if (m_isPlaying && m_audioDevice.get()) {
+ m_audioDevice->stop();
+ m_isPlaying = false;
+ }
+}
+
+double AudioDestination::hardwareSampleRate()
+{
+ // FIXME: implement this properly for Chromium.
+ return 44100.0;
+}
+
+// Pulls on our provider to get the rendered audio stream.
+void AudioDestinationChromium::render(const WebVector<float*>& audioData, size_t numberOfFrames)
+{
+ bool isNumberOfChannelsGood = audioData.size() == numberOfChannels;
+ if (!isNumberOfChannelsGood) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ bool isBufferSizeGood = numberOfFrames == callbackBufferSize;
+ if (!isBufferSizeGood) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ // Split up the callback buffer into smaller chunks which we'll render one after the other.
+ for (unsigned i = 0; i < renderCountPerCallback; ++i) {
+ m_renderBus.setChannelMemory(0, audioData[0] + i * renderBufferSize, renderBufferSize);
+ m_renderBus.setChannelMemory(1, audioData[1] + i * renderBufferSize, renderBufferSize);
+ m_provider.provideInput(&m_renderBus, renderBufferSize);
+ }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
diff --git a/WebKit/chromium/src/AudioDestinationChromium.h b/WebKit/chromium/src/AudioDestinationChromium.h
new file mode 100644
index 0000000..a2a2b58
--- /dev/null
+++ b/WebKit/chromium/src/AudioDestinationChromium.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AudioDestinationChromium_h
+#define AudioDestinationChromium_h
+
+#include "AudioBus.h"
+#include "AudioDestination.h"
+#include "WebAudioDevice.h"
+#include "WebVector.h"
+
+namespace WebKit { class WebAudioDevice; }
+
+namespace WebCore {
+
+// An AudioDestination using Chromium's audio system
+
+class AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback {
+public:
+ AudioDestinationChromium(AudioSourceProvider&, double sampleRate);
+ virtual ~AudioDestinationChromium();
+
+ virtual void start();
+ virtual void stop();
+ bool isPlaying() { return m_isPlaying; }
+
+ double sampleRate() const { return m_sampleRate; }
+
+ // WebKit::WebAudioDevice::RenderCallback
+ virtual void render(const WebKit::WebVector<float*>& audioData, size_t numberOfFrames);
+
+private:
+ AudioSourceProvider& m_provider;
+ AudioBus m_renderBus;
+ double m_sampleRate;
+ bool m_isPlaying;
+ OwnPtr<WebKit::WebAudioDevice> m_audioDevice;
+};
+
+} // namespace WebCore
+
+#endif // AudioDestinationChromium_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list