Diff
Modified: releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog 2015-01-12 14:13:51 UTC (rev 178257)
@@ -1,3 +1,13 @@
+2014-11-18 Philippe Normand <pnorm...@igalia.com>
+
+ start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args
+ https://bugs.webkit.org/show_bug.cgi?id=138739
+
+ Reviewed by Darin Adler.
+
+ * webaudio/dom-exceptions-expected.txt: Added.
+ * webaudio/dom-exceptions.html: Added.
+
2014-11-18 Joanmarie Diggs <jdi...@igalia.com>
AX: [ATK] Crash getting the orientation of a MenuListOption after the MenuList was removed from the document
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog 2015-01-12 14:13:51 UTC (rev 178257)
@@ -1,5 +1,31 @@
2014-11-18 Philippe Normand <pnorm...@igalia.com>
+ start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args
+ https://bugs.webkit.org/show_bug.cgi?id=138739
+
+ Reviewed by Darin Adler.
+
+ The patch is inspired by the following Blink revision by
+ <r...@google.com>:
+ <https://src.chromium.org/viewvc/blink?view=rev&revision=160845>
+
+ Test: webaudio/dom-exceptions.html
+
+ * Modules/webaudio/AudioBufferSourceNode.cpp:
+ (WebCore::AudioBufferSourceNode::start):
+ (WebCore::AudioBufferSourceNode::startPlaying):
+ (WebCore::AudioBufferSourceNode::noteGrainOn):
+ (WebCore::AudioBufferSourceNode::startGrain): Deleted.
+ * Modules/webaudio/AudioBufferSourceNode.h:
+ * Modules/webaudio/AudioBufferSourceNode.idl:
+ * Modules/webaudio/AudioScheduledSourceNode.cpp:
+ (WebCore::AudioScheduledSourceNode::start):
+ (WebCore::AudioScheduledSourceNode::stop):
+ * Modules/webaudio/AudioScheduledSourceNode.h:
+ * Modules/webaudio/OscillatorNode.idl:
+
+2014-11-18 Philippe Normand <pnorm...@igalia.com>
+
HRTFDatabaseLoader is not an absolute condition to run audioContext
https://bugs.webkit.org/show_bug.cgi?id=138829
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2015-01-12 14:13:51 UTC (rev 178257)
@@ -370,14 +370,28 @@
return output(0)->numberOfChannels();
}
-void AudioBufferSourceNode::startGrain(double when, double grainOffset, ExceptionCode& ec)
+void AudioBufferSourceNode::start(ExceptionCode& ec)
{
- // Duration of 0 has special value, meaning calculate based on the entire buffer's duration.
- startGrain(when, grainOffset, 0, ec);
+ startPlaying(Entire, 0, 0, buffer() ? buffer()->duration() : 0, ec);
}
-void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration, ExceptionCode& ec)
+void AudioBufferSourceNode::start(double when, ExceptionCode& ec)
{
+ startPlaying(Entire, when, 0, buffer() ? buffer()->duration() : 0, ec);
+}
+
+void AudioBufferSourceNode::start(double when, double grainOffset, ExceptionCode& ec)
+{
+ startPlaying(Partial, when, grainOffset, 0, ec);
+}
+
+void AudioBufferSourceNode::start(double when, double grainOffset, double grainDuration, ExceptionCode& ec)
+{
+ startPlaying(Partial, when, grainOffset, grainDuration, ec);
+}
+
+void AudioBufferSourceNode::startPlaying(BufferPlaybackMode playbackMode, double when, double grainOffset, double grainDuration, ExceptionCode& ec)
+{
ASSERT(isMainThread());
if (ScriptController::processingUserGesture())
@@ -388,26 +402,38 @@
return;
}
+ if (!std::isfinite(when) || (when < 0)) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
+ if (!std::isfinite(grainOffset) || (grainOffset < 0)) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
+ if (!std::isfinite(grainDuration) || (grainDuration < 0)) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
if (!buffer())
return;
-
- // Do sanity checking of grain parameters versus buffer size.
- double bufferDuration = buffer()->duration();
- grainOffset = std::max(0.0, grainOffset);
- grainOffset = std::min(bufferDuration, grainOffset);
- m_grainOffset = grainOffset;
+ m_isGrain = playbackMode == Partial;
+ if (m_isGrain) {
+ // Do sanity checking of grain parameters versus buffer size.
+ double bufferDuration = buffer()->duration();
- // Handle default/unspecified duration.
- double maxDuration = bufferDuration - grainOffset;
- if (!grainDuration)
- grainDuration = maxDuration;
+ m_grainOffset = std::min(bufferDuration, grainOffset);
- grainDuration = std::max(0.0, grainDuration);
- grainDuration = std::min(maxDuration, grainDuration);
- m_grainDuration = grainDuration;
+ double maxDuration = bufferDuration - m_grainOffset;
+ m_grainDuration = std::min(maxDuration, grainDuration);
+ } else {
+ m_grainOffset = 0.0;
+ m_grainDuration = DefaultGrainDuration;
+ }
- m_isGrain = true;
m_startTime = when;
// We call timeToSampleFrame here since at playbackRate == 1 we don't want to go through linear interpolation
@@ -422,7 +448,10 @@
#if ENABLE(LEGACY_WEB_AUDIO)
void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode& ec)
{
- startGrain(when, grainOffset, grainDuration, ec);
+ // Handle unspecified duration where 0 means the rest of the buffer.
+ if (!grainDuration)
+ grainDuration = buffer()->duration();
+ startPlaying(Partial, when, grainOffset, grainDuration, ec);
}
#endif
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h 2015-01-12 14:13:51 UTC (rev 178257)
@@ -63,8 +63,10 @@
unsigned numberOfChannels();
// Play-state
- void startGrain(double when, double grainOffset, ExceptionCode&);
- void startGrain(double when, double grainOffset, double grainDuration, ExceptionCode&);
+ void start(ExceptionCode&);
+ void start(double when, ExceptionCode&);
+ void start(double when, double grainOffset, ExceptionCode&);
+ void start(double when, double grainOffset, double grainDuration, ExceptionCode&);
#if ENABLE(LEGACY_WEB_AUDIO)
void noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode&);
@@ -105,6 +107,13 @@
virtual double tailTime() const override { return 0; }
virtual double latencyTime() const override { return 0; }
+ enum BufferPlaybackMode {
+ Entire,
+ Partial
+ };
+
+ void startPlaying(BufferPlaybackMode, double when, double grainOffset, double grainDuration, ExceptionCode&);
+
// Returns true on success.
bool renderFromBuffer(AudioBus*, unsigned destinationFrameOffset, size_t numberOfFrames);
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl 2015-01-12 14:13:51 UTC (rev 178257)
@@ -44,10 +44,8 @@
attribute unrestricted double loopStart;
attribute unrestricted double loopEnd;
- [RaisesException] void start(unrestricted double when);
- [ImplementedAs=startGrain, RaisesException] void start(unrestricted double when, unrestricted double grainOffset);
- [ImplementedAs=startGrain, RaisesException] void start(unrestricted double when, unrestricted double grainOffset, unrestricted double grainDuration);
- [RaisesException] void stop(unrestricted double when);
+ [RaisesException] void start(optional unrestricted double when, optional unrestricted double grainOffset, optional unrestricted double grainDuration);
+ [RaisesException] void stop(optional unrestricted double when);
[Conditional=LEGACY_WEB_AUDIO] attribute boolean looping; // This is an alias for the .loop attribute for backwards compatibility.
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp 2015-01-12 14:13:51 UTC (rev 178257)
@@ -137,6 +137,11 @@
return;
}
+void AudioScheduledSourceNode::start(ExceptionCode& ec)
+{
+ start(0, ec);
+}
+
void AudioScheduledSourceNode::start(double when, ExceptionCode& ec)
{
ASSERT(isMainThread());
@@ -149,10 +154,20 @@
return;
}
+ if (!std::isfinite(when) || (when < 0)) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
m_startTime = when;
m_playbackState = SCHEDULED_STATE;
}
+void AudioScheduledSourceNode::stop(ExceptionCode& ec)
+{
+ stop(0, ec);
+}
+
void AudioScheduledSourceNode::stop(double when, ExceptionCode& ec)
{
ASSERT(isMainThread());
@@ -160,8 +175,12 @@
ec = INVALID_STATE_ERR;
return;
}
-
- when = std::max<double>(0, when);
+
+ if (!std::isfinite(when) || (when < 0)) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
m_endTime = when;
}
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h 2015-01-12 14:13:51 UTC (rev 178257)
@@ -58,6 +58,8 @@
AudioScheduledSourceNode(AudioContext*, float sampleRate);
// Scheduling.
+ void start(ExceptionCode&);
+ void stop(ExceptionCode&);
void start(double when, ExceptionCode&);
void stop(double when, ExceptionCode&);
Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/OscillatorNode.idl (178256 => 178257)
--- releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2015-01-12 14:06:41 UTC (rev 178256)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2015-01-12 14:13:51 UTC (rev 178257)
@@ -48,8 +48,8 @@
readonly attribute AudioParam frequency; // in Hertz
readonly attribute AudioParam detune; // in Cents
- [RaisesException] void start(unrestricted double when);
- [RaisesException] void stop(unrestricted double when);
+ [RaisesException] void start(optional unrestricted double when);
+ [RaisesException] void stop(optional unrestricted double when);
[Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOn(unrestricted double when);
[Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOff(unrestricted double when);