OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 13 matching lines...) Expand all Loading... | |
24 */ | 24 */ |
25 | 25 |
26 #include "modules/webaudio/DefaultAudioDestinationNode.h" | 26 #include "modules/webaudio/DefaultAudioDestinationNode.h" |
27 #include "bindings/core/v8/ExceptionMessages.h" | 27 #include "bindings/core/v8/ExceptionMessages.h" |
28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
29 #include "core/dom/ExceptionCode.h" | 29 #include "core/dom/ExceptionCode.h" |
30 #include "modules/webaudio/BaseAudioContext.h" | 30 #include "modules/webaudio/BaseAudioContext.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 DefaultAudioDestinationHandler::DefaultAudioDestinationHandler(AudioNode& node) | 34 DefaultAudioDestinationHandler::DefaultAudioDestinationHandler( |
35 AudioNode& node, | |
36 const WebAudioLatencyHint& latencyHint) | |
35 : AudioDestinationHandler(node, AudioDestination::hardwareSampleRate()), | 37 : AudioDestinationHandler(node, AudioDestination::hardwareSampleRate()), |
36 m_numberOfInputChannels(0) { | 38 m_numberOfInputChannels(0), |
39 m_latencyHint(latencyHint) { | |
37 // Node-specific default mixing rules. | 40 // Node-specific default mixing rules. |
38 m_channelCount = 2; | 41 m_channelCount = 2; |
39 setInternalChannelCountMode(Explicit); | 42 setInternalChannelCountMode(Explicit); |
40 setInternalChannelInterpretation(AudioBus::Speakers); | 43 setInternalChannelInterpretation(AudioBus::Speakers); |
41 } | 44 } |
42 | 45 |
43 PassRefPtr<DefaultAudioDestinationHandler> | 46 PassRefPtr<DefaultAudioDestinationHandler> |
44 DefaultAudioDestinationHandler::create(AudioNode& node) { | 47 DefaultAudioDestinationHandler::create(AudioNode& node, |
45 return adoptRef(new DefaultAudioDestinationHandler(node)); | 48 const WebAudioLatencyHint& latencyHint) { |
49 return adoptRef(new DefaultAudioDestinationHandler(node, latencyHint)); | |
46 } | 50 } |
47 | 51 |
48 DefaultAudioDestinationHandler::~DefaultAudioDestinationHandler() { | 52 DefaultAudioDestinationHandler::~DefaultAudioDestinationHandler() { |
49 DCHECK(!isInitialized()); | 53 DCHECK(!isInitialized()); |
50 } | 54 } |
51 | 55 |
52 void DefaultAudioDestinationHandler::dispose() { | 56 void DefaultAudioDestinationHandler::dispose() { |
53 uninitialize(); | 57 uninitialize(); |
54 AudioDestinationHandler::dispose(); | 58 AudioDestinationHandler::dispose(); |
55 } | 59 } |
(...skipping 12 matching lines...) Expand all Loading... | |
68 if (!isInitialized()) | 72 if (!isInitialized()) |
69 return; | 73 return; |
70 | 74 |
71 m_destination->stop(); | 75 m_destination->stop(); |
72 m_numberOfInputChannels = 0; | 76 m_numberOfInputChannels = 0; |
73 | 77 |
74 AudioHandler::uninitialize(); | 78 AudioHandler::uninitialize(); |
75 } | 79 } |
76 | 80 |
77 void DefaultAudioDestinationHandler::createDestination() { | 81 void DefaultAudioDestinationHandler::createDestination() { |
78 float hardwareSampleRate = AudioDestination::hardwareSampleRate(); | |
79 VLOG(1) << ">>>> hardwareSampleRate = " << hardwareSampleRate; | |
Raymond Toy
2016/11/15 18:16:17
I hope we didn't lose this log print. It's really
Andrew MacPherson
2016/11/16 10:58:29
Should I re-add the log print though we won't pass
| |
80 | |
81 m_destination = AudioDestination::create( | 82 m_destination = AudioDestination::create( |
82 *this, m_inputDeviceId, m_numberOfInputChannels, channelCount(), | 83 *this, m_inputDeviceId, m_numberOfInputChannels, channelCount(), |
83 hardwareSampleRate, context()->getSecurityOrigin()); | 84 m_latencyHint, context()->getSecurityOrigin()); |
84 } | 85 } |
85 | 86 |
86 void DefaultAudioDestinationHandler::startRendering() { | 87 void DefaultAudioDestinationHandler::startRendering() { |
87 DCHECK(isInitialized()); | 88 DCHECK(isInitialized()); |
88 if (isInitialized()) { | 89 if (isInitialized()) { |
89 DCHECK(!m_destination->isPlaying()); | 90 DCHECK(!m_destination->isPlaying()); |
90 m_destination->start(); | 91 m_destination->start(); |
91 } | 92 } |
92 } | 93 } |
93 | 94 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 // Re-create destination. | 130 // Re-create destination. |
130 m_destination->stop(); | 131 m_destination->stop(); |
131 createDestination(); | 132 createDestination(); |
132 m_destination->start(); | 133 m_destination->start(); |
133 } | 134 } |
134 } | 135 } |
135 | 136 |
136 // ---------------------------------------------------------------- | 137 // ---------------------------------------------------------------- |
137 | 138 |
138 DefaultAudioDestinationNode::DefaultAudioDestinationNode( | 139 DefaultAudioDestinationNode::DefaultAudioDestinationNode( |
139 BaseAudioContext& context) | 140 BaseAudioContext& context, |
141 const WebAudioLatencyHint& latencyHint) | |
140 : AudioDestinationNode(context) { | 142 : AudioDestinationNode(context) { |
141 setHandler(DefaultAudioDestinationHandler::create(*this)); | 143 setHandler(DefaultAudioDestinationHandler::create(*this, latencyHint)); |
142 } | 144 } |
143 | 145 |
144 DefaultAudioDestinationNode* DefaultAudioDestinationNode::create( | 146 DefaultAudioDestinationNode* DefaultAudioDestinationNode::create( |
145 BaseAudioContext* context) { | 147 BaseAudioContext* context, |
146 return new DefaultAudioDestinationNode(*context); | 148 const WebAudioLatencyHint& latencyHint) { |
149 return new DefaultAudioDestinationNode(*context, latencyHint); | |
147 } | 150 } |
148 | 151 |
149 } // namespace blink | 152 } // namespace blink |
OLD | NEW |