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

Unified Diff: third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Add baseLatency and fix use of hardwareSampleRate. Created 4 years, 1 month 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: third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
index f6f9c48cc2f7924c6f9148ed9c5f8a6dd623b376..b7688739a710442cb8a373cff0bd5bd74bd25d81 100644
--- a/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/DefaultAudioDestinationNode.cpp
@@ -31,9 +31,12 @@
namespace blink {
-DefaultAudioDestinationHandler::DefaultAudioDestinationHandler(AudioNode& node)
- : AudioDestinationHandler(node, AudioDestination::hardwareSampleRate()),
- m_numberOfInputChannels(0) {
+DefaultAudioDestinationHandler::DefaultAudioDestinationHandler(
+ AudioNode& node,
+ const WebAudioLatencyHint& latencyHint)
+ : AudioDestinationHandler(node),
+ m_numberOfInputChannels(0),
+ m_latencyHint(latencyHint) {
// Node-specific default mixing rules.
m_channelCount = 2;
setInternalChannelCountMode(Explicit);
@@ -41,8 +44,9 @@ DefaultAudioDestinationHandler::DefaultAudioDestinationHandler(AudioNode& node)
}
PassRefPtr<DefaultAudioDestinationHandler>
-DefaultAudioDestinationHandler::create(AudioNode& node) {
- return adoptRef(new DefaultAudioDestinationHandler(node));
+DefaultAudioDestinationHandler::create(AudioNode& node,
+ const WebAudioLatencyHint& latencyHint) {
+ return adoptRef(new DefaultAudioDestinationHandler(node, latencyHint));
}
DefaultAudioDestinationHandler::~DefaultAudioDestinationHandler() {
@@ -75,12 +79,9 @@ void DefaultAudioDestinationHandler::uninitialize() {
}
void DefaultAudioDestinationHandler::createDestination() {
- float hardwareSampleRate = AudioDestination::hardwareSampleRate();
- VLOG(1) << ">>>> hardwareSampleRate = " << hardwareSampleRate;
-
m_destination = AudioDestination::create(
*this, m_inputDeviceId, m_numberOfInputChannels, channelCount(),
- hardwareSampleRate, context()->getSecurityOrigin());
+ m_latencyHint, context()->getSecurityOrigin());
}
void DefaultAudioDestinationHandler::startRendering() {
@@ -133,17 +134,27 @@ void DefaultAudioDestinationHandler::setChannelCount(
}
}
+double DefaultAudioDestinationHandler::sampleRate() const {
+ return m_destination ? m_destination->sampleRate() : 0;
+}
+
+int DefaultAudioDestinationHandler::framesPerBuffer() const {
+ return m_destination ? m_destination->framesPerBuffer() : 0;
+}
+
// ----------------------------------------------------------------
DefaultAudioDestinationNode::DefaultAudioDestinationNode(
- BaseAudioContext& context)
+ BaseAudioContext& context,
+ const WebAudioLatencyHint& latencyHint)
: AudioDestinationNode(context) {
- setHandler(DefaultAudioDestinationHandler::create(*this));
+ setHandler(DefaultAudioDestinationHandler::create(*this, latencyHint));
}
DefaultAudioDestinationNode* DefaultAudioDestinationNode::create(
- BaseAudioContext* context) {
- return new DefaultAudioDestinationNode(*context);
+ BaseAudioContext* context,
+ const WebAudioLatencyHint& latencyHint) {
+ return new DefaultAudioDestinationNode(*context, latencyHint);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698