Skip to content

Commit

Permalink
Merge r228321 - [GStreamer][WebAudio] Winamp2-js woes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=182612

Reviewed by Xabier Rodriguez Calvar and Carlos Alberto Lopez Perez.

Source/WebCore:

Test: webaudio/silence-after-playback.html

* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::copyGStreamerBuffersToAudioChannel): Clear the bus if
the adapter can't provide enough data. This prevents a nasty noise
after playing songs in Winamp.
(WebCore::AudioSourceProviderGStreamer::setClient): No need to set
the client more than once, this fixes runtime warnings.

LayoutTests:

* webaudio/silence-after-playback-expected.wav: Added.
* webaudio/silence-after-playback.html: Added.
  • Loading branch information
philn authored and carlosgcampos committed Feb 19, 2018
1 parent 1b31cb5 commit 4a495e7
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1 deletion.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
2018-02-09 Philippe Normand <pnormand@igalia.com>

[GStreamer][WebAudio] Winamp2-js woes
https://bugs.webkit.org/show_bug.cgi?id=182612

Reviewed by Xabier Rodriguez Calvar and Carlos Alberto Lopez Perez.

* webaudio/silence-after-playback-expected.wav: Added.
* webaudio/silence-after-playback.html: Added.

2018-02-09 Javier Fernandez <jfernandez@igalia.com>

[css-align] Implement the new behavior of 'legacy' for justify-items
Expand Down
Binary file not shown.
Binary file not shown.
44 changes: 44 additions & 0 deletions LayoutTests/webaudio/silence-after-playback.html
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="resources/audio-testing.js"></script>
</head>

<body>
<div id="description"></div>
<div id="console"></div>

<script>
description("Test ensuring silence is output after <audio> playback ended.");

let context = 0;
const sampleRate = 44100.0;
const lengthInSeconds = 3;

function ended() {
context.startRendering();
context.oncomplete = finishAudioTest;
}

function runTest() {
context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);

audioElement = new Audio();
audioElement.src = "resources/media/128kbps-44khz.mp3";
document.body.appendChild(audioElement);

mediaSource = context.createMediaElementSource(audioElement);
window.audioNode = mediaSource;

mediaSource.connect(context.destination);

audioElement.play();
audioElement.addEventListener("ended", ended, true);
testRunner.waitUntilDone();
}

runTest();
</script>
</body>
</html>
16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
2018-02-08 Philippe Normand <pnormand@igalia.com>

[GStreamer][WebAudio] Winamp2-js woes
https://bugs.webkit.org/show_bug.cgi?id=182612

Reviewed by Xabier Rodriguez Calvar and Carlos Alberto Lopez Perez.

Test: webaudio/silence-after-playback.html

* platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
(WebCore::copyGStreamerBuffersToAudioChannel): Clear the bus if
the adapter can't provide enough data. This prevents a nasty noise
after playing songs in Winamp.
(WebCore::AudioSourceProviderGStreamer::setClient): No need to set
the client more than once, this fixes runtime warnings.

2018-02-09 Zalan Bujtas <zalan@apple.com>

[RenderTreeBuilder] Move multicolumn spanner mutation logic to RenderTreeBuilder
Expand Down
Expand Up @@ -79,7 +79,8 @@ static void copyGStreamerBuffersToAudioChannel(GstAdapter* adapter, AudioBus* bu
if (gst_adapter_available(adapter) >= bytes) {
gst_adapter_copy(adapter, bus->channel(channelNumber)->mutableData(), 0, bytes);
gst_adapter_flush(adapter, bytes);
}
} else
bus->zero();
}

AudioSourceProviderGStreamer::AudioSourceProviderGStreamer()
Expand Down Expand Up @@ -201,6 +202,9 @@ GstFlowReturn AudioSourceProviderGStreamer::handleAudioBuffer(GstAppSink* sink)

void AudioSourceProviderGStreamer::setClient(AudioSourceProviderClient* client)
{
if (m_client)
return;

ASSERT(client);
m_client = client;

Expand Down

0 comments on commit 4a495e7

Please sign in to comment.