Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 // channcelCountMode must be 'explicit'. | 112 // channcelCountMode must be 'explicit'. |
| 113 if (mode != "explicit") { | 113 if (mode != "explicit") { |
| 114 exceptionState.throwDOMException( | 114 exceptionState.throwDOMException( |
| 115 InvalidStateError, | 115 InvalidStateError, |
| 116 "ChannelMerger: channelCountMode cannot be changed from 'explicit'") ; | 116 "ChannelMerger: channelCountMode cannot be changed from 'explicit'") ; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 // ---------------------------------------------------------------- | 120 // ---------------------------------------------------------------- |
| 121 | 121 |
| 122 ChannelMergerNode::ChannelMergerNode(AbstractAudioContext& context, float sample Rate, unsigned numberOfInputs) | 122 ChannelMergerNode::ChannelMergerNode(AbstractAudioContext& context, unsigned num berOfInputs) |
| 123 : AudioNode(context) | 123 : AudioNode(context) |
| 124 { | 124 { |
| 125 setHandler(ChannelMergerHandler::create(*this, sampleRate, numberOfInputs)); | 125 setHandler(ChannelMergerHandler::create(*this, context.sampleRate(), numberO fInputs)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 ChannelMergerNode* ChannelMergerNode::create(AbstractAudioContext& context, floa t sampleRate, unsigned numberOfInputs) | 128 ChannelMergerNode* ChannelMergerNode::create(AbstractAudioContext& context, Exce ptionState& exceptionState) |
| 129 { | 129 { |
| 130 if (!numberOfInputs || numberOfInputs > AbstractAudioContext::maxNumberOfCha nnels()) | 130 ASSERT(isMainThread()); |
|
hongchan
2016/05/13 01:20:11
DCHECK?
Raymond Toy
2016/05/20 23:12:00
Done.
| |
| 131 | |
| 132 const unsigned ChannelMergerDefaultNumberOfInputs = 6; | |
|
hongchan
2016/05/13 01:20:11
Can we add TODO here? - "Create a global config fi
Raymond Toy
2016/05/13 15:59:51
Having a global for a constant that is used in exa
| |
| 133 return create(context, ChannelMergerDefaultNumberOfInputs, exceptionState); | |
| 134 } | |
| 135 | |
| 136 ChannelMergerNode* ChannelMergerNode::create(AbstractAudioContext& context, unsi gned numberOfInputs, ExceptionState& exceptionState) | |
| 137 { | |
| 138 ASSERT(isMainThread()); | |
|
hongchan
2016/05/13 01:20:11
Ditto.
Raymond Toy
2016/05/20 23:12:00
Done.
| |
| 139 | |
| 140 if (context.isContextClosed()) { | |
| 141 context.throwExceptionForClosedState(exceptionState); | |
| 131 return nullptr; | 142 return nullptr; |
| 132 return new ChannelMergerNode(context, sampleRate, numberOfInputs); | 143 } |
| 144 | |
| 145 if (!numberOfInputs || numberOfInputs > AbstractAudioContext::maxNumberOfCha nnels()) { | |
| 146 exceptionState.throwDOMException( | |
| 147 IndexSizeError, | |
| 148 ExceptionMessages::indexOutsideRange<size_t>( | |
| 149 "number of inputs", | |
| 150 numberOfInputs, | |
| 151 1, | |
| 152 ExceptionMessages::InclusiveBound, | |
| 153 AbstractAudioContext::maxNumberOfChannels(), | |
| 154 ExceptionMessages::InclusiveBound)); | |
| 155 return nullptr; | |
| 156 } | |
| 157 | |
| 158 return new ChannelMergerNode(context, numberOfInputs); | |
| 133 } | 159 } |
| 134 | 160 |
| 135 } // namespace blink | 161 } // namespace blink |
| 136 | 162 |
| OLD | NEW |