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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioNode.cpp

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Updates based on reviewer comments. Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 27 matching lines...) Expand all
38 #include <stdio.h> 38 #include <stdio.h>
39 #endif 39 #endif
40 40
41 namespace blink { 41 namespace blink {
42 42
43 AudioHandler::AudioHandler(NodeType nodeType, AudioNode& node, float sampleRate) 43 AudioHandler::AudioHandler(NodeType nodeType, AudioNode& node, float sampleRate)
44 : m_isInitialized(false), 44 : m_isInitialized(false),
45 m_nodeType(NodeTypeUnknown), 45 m_nodeType(NodeTypeUnknown),
46 m_node(&node), 46 m_node(&node),
47 m_context(node.context()), 47 m_context(node.context()),
48 m_sampleRate(sampleRate),
49 m_lastProcessingTime(-1), 48 m_lastProcessingTime(-1),
50 m_lastNonSilentTime(-1), 49 m_lastNonSilentTime(-1),
51 m_connectionRefCount(0), 50 m_connectionRefCount(0),
52 m_isDisabled(false), 51 m_isDisabled(false),
53 m_channelCount(2) { 52 m_channelCount(2) {
54 setNodeType(nodeType); 53 setNodeType(nodeType);
55 setInternalChannelCountMode(Max); 54 setInternalChannelCountMode(Max);
56 setInternalChannelInterpretation(AudioBus::Speakers); 55 setInternalChannelInterpretation(AudioBus::Speakers);
57 56
58 #if DEBUG_AUDIONODE_REFERENCES 57 #if DEBUG_AUDIONODE_REFERENCES
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // have the results cached in their bus; 315 // have the results cached in their bus;
317 double currentTime = context()->currentTime(); 316 double currentTime = context()->currentTime();
318 if (m_lastProcessingTime != currentTime) { 317 if (m_lastProcessingTime != currentTime) {
319 // important to first update this time because of feedback loops in the 318 // important to first update this time because of feedback loops in the
320 // rendering graph. 319 // rendering graph.
321 m_lastProcessingTime = currentTime; 320 m_lastProcessingTime = currentTime;
322 321
323 pullInputs(framesToProcess); 322 pullInputs(framesToProcess);
324 323
325 bool silentInputs = inputsAreSilent(); 324 bool silentInputs = inputsAreSilent();
326 if (!silentInputs) 325 if (!silentInputs) {
327 m_lastNonSilentTime = 326 m_lastNonSilentTime =
328 (context()->currentSampleFrame() + framesToProcess) / 327 (context()->currentSampleFrame() + framesToProcess) /
329 static_cast<double>(m_sampleRate); 328 static_cast<double>(context()->sampleRate());
329 }
330 330
331 if (silentInputs && propagatesSilence()) { 331 if (silentInputs && propagatesSilence()) {
332 silenceOutputs(); 332 silenceOutputs();
333 } else { 333 } else {
334 // Unsilence the outputs first because the processing of the node may 334 // Unsilence the outputs first because the processing of the node may
335 // cause the outputs to go silent and we want to propagate that hint to 335 // cause the outputs to go silent and we want to propagate that hint to
336 // the downstream nodes. (For example, a Gain node with a gain of 0 will 336 // the downstream nodes. (For example, a Gain node with a gain of 0 will
337 // want to silence its output.) 337 // want to silence its output.)
338 unsilenceOutputs(); 338 unsilenceOutputs();
339 process(framesToProcess); 339 process(framesToProcess);
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 } 944 }
945 945
946 void AudioNode::didAddOutput(unsigned numberOfOutputs) { 946 void AudioNode::didAddOutput(unsigned numberOfOutputs) {
947 m_connectedNodes.append(nullptr); 947 m_connectedNodes.append(nullptr);
948 DCHECK_EQ(numberOfOutputs, m_connectedNodes.size()); 948 DCHECK_EQ(numberOfOutputs, m_connectedNodes.size());
949 m_connectedParams.append(nullptr); 949 m_connectedParams.append(nullptr);
950 DCHECK_EQ(numberOfOutputs, m_connectedParams.size()); 950 DCHECK_EQ(numberOfOutputs, m_connectedParams.size());
951 } 951 }
952 952
953 } // namespace blink 953 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698