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

Unified Diff: Source/modules/webaudio/MediaElementAudioSourceNode.cpp

Issue 520433002: Output silence if the MediaElementAudioSourceNode has a different origin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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: Source/modules/webaudio/MediaElementAudioSourceNode.cpp
diff --git a/Source/modules/webaudio/MediaElementAudioSourceNode.cpp b/Source/modules/webaudio/MediaElementAudioSourceNode.cpp
index 12678d1a8f104f579e058d107a0045e73d529789..2abb368a76bad3c5fdf889c8231d69e397faa5c0 100644
--- a/Source/modules/webaudio/MediaElementAudioSourceNode.cpp
+++ b/Source/modules/webaudio/MediaElementAudioSourceNode.cpp
@@ -33,6 +33,8 @@
#include "modules/webaudio/AudioNodeOutput.h"
#include "platform/Logging.h"
#include "platform/audio/AudioUtilities.h"
+#include "platform/graphics/media/MediaPlayer.h"
+#include "platform/weborigin/SecurityOrigin.h"
#include "wtf/Locker.h"
namespace blink {
@@ -117,6 +119,8 @@ void MediaElementAudioSourceNode::process(size_t numberOfFrames)
MutexTryLocker tryLocker(m_processLock);
if (tryLocker.locked()) {
if (AudioSourceProvider* provider = mediaElement()->audioSourceProvider()) {
+ // Grab data from the provider so that the element continues to make progress, even if
+ // we're going to output silence anyway.
if (m_multiChannelResampler.get()) {
ASSERT(m_sourceSampleRate != sampleRate());
m_multiChannelResampler->process(provider, outputBus, numberOfFrames);
@@ -125,6 +129,11 @@ void MediaElementAudioSourceNode::process(size_t numberOfFrames)
ASSERT(m_sourceSampleRate == sampleRate());
provider->provideInput(outputBus, numberOfFrames);
}
+ // Output silence if we don't have access to the element.
+ if (!(mediaElement()->webMediaPlayer()->didPassCORSAccessCheck()
+ || context()->securityOrigin()->canRequest(mediaElement()->currentSrc()))) {
Ken Russell (switch to Gerrit) 2015/02/04 01:28:19 The indentation looks confusing here. I'd indent t
Raymond Toy 2015/02/04 19:00:38 Clang-format puts || under the "d" in mediaElement
+ outputBus->zero();
+ }
} else {
// Either this port doesn't yet support HTMLMediaElement audio stream access,
// or the stream is not yet available.

Powered by Google App Engine
This is Rietveld 408576698