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

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

Issue 2159403002: Replace ASSERT with DCHECK in WebAudio (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 case BiquadProcessor::Allpass: 109 case BiquadProcessor::Allpass:
110 m_biquad.setAllpassParams(k, normalizedFrequency, Q[k]); 110 m_biquad.setAllpassParams(k, normalizedFrequency, Q[k]);
111 break; 111 break;
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 void BiquadDSPKernel::process(const float* source, float* destination, size_t fr amesToProcess) 116 void BiquadDSPKernel::process(const float* source, float* destination, size_t fr amesToProcess)
117 { 117 {
118 ASSERT(source); 118 DCHECK(source);
119 ASSERT(destination); 119 DCHECK(destination);
120 ASSERT(getBiquadProcessor()); 120 DCHECK(getBiquadProcessor());
121 121
122 // Recompute filter coefficients if any of the parameters have changed. 122 // Recompute filter coefficients if any of the parameters have changed.
123 // FIXME: as an optimization, implement a way that a Biquad object can simpl y copy its internal filter coefficients from another Biquad object. 123 // FIXME: as an optimization, implement a way that a Biquad object can simpl y copy its internal filter coefficients from another Biquad object.
124 // Then re-factor this code to only run for the first BiquadDSPKernel of eac h BiquadProcessor. 124 // Then re-factor this code to only run for the first BiquadDSPKernel of eac h BiquadProcessor.
125 125
126 126
127 // The audio thread can't block on this lock; skip updating the coefficients for this block if 127 // The audio thread can't block on this lock; skip updating the coefficients for this block if
128 // necessary. We'll get them the next time around. 128 // necessary. We'll get them the next time around.
129 { 129 {
130 MutexTryLocker tryLocker(m_processLock); 130 MutexTryLocker tryLocker(m_processLock);
131 if (tryLocker.locked()) 131 if (tryLocker.locked())
132 updateCoefficientsIfNecessary(framesToProcess); 132 updateCoefficientsIfNecessary(framesToProcess);
133 } 133 }
134 134
135 m_biquad.process(source, destination, framesToProcess); 135 m_biquad.process(source, destination, framesToProcess);
136 } 136 }
137 137
138 void BiquadDSPKernel::getFrequencyResponse(int nFrequencies, const float* freque ncyHz, float* magResponse, float* phaseResponse) 138 void BiquadDSPKernel::getFrequencyResponse(int nFrequencies, const float* freque ncyHz, float* magResponse, float* phaseResponse)
139 { 139 {
140 bool isGood = nFrequencies > 0 && frequencyHz && magResponse && phaseRespons e; 140 bool isGood = nFrequencies > 0 && frequencyHz && magResponse && phaseRespons e;
141 ASSERT(isGood); 141 DCHECK(isGood);
142 if (!isGood) 142 if (!isGood)
143 return; 143 return;
144 144
145 Vector<float> frequency(nFrequencies); 145 Vector<float> frequency(nFrequencies);
146 146
147 double nyquist = this->nyquist(); 147 double nyquist = this->nyquist();
148 148
149 // Convert from frequency in Hz to normalized frequency (0 -> 1), 149 // Convert from frequency in Hz to normalized frequency (0 -> 1),
150 // with 1 equal to the Nyquist frequency. 150 // with 1 equal to the Nyquist frequency.
151 for (int k = 0; k < nFrequencies; ++k) 151 for (int k = 0; k < nFrequencies; ++k)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return MaxBiquadDelayTime; 187 return MaxBiquadDelayTime;
188 } 188 }
189 189
190 double BiquadDSPKernel::latencyTime() const 190 double BiquadDSPKernel::latencyTime() const
191 { 191 {
192 return 0; 192 return 0;
193 } 193 }
194 194
195 } // namespace blink 195 } // namespace blink
196 196
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698