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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/WaveShaperProcessor.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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) 79 void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess)
80 { 80 {
81 if (!isInitialized()) { 81 if (!isInitialized()) {
82 destination->zero(); 82 destination->zero();
83 return; 83 return;
84 } 84 }
85 85
86 bool channelCountMatches = source->numberOfChannels() == destination->number OfChannels() && source->numberOfChannels() == m_kernels.size(); 86 bool channelCountMatches = source->numberOfChannels() == destination->number OfChannels() && source->numberOfChannels() == m_kernels.size();
87 ASSERT(channelCountMatches); 87 DCHECK(channelCountMatches);
88 if (!channelCountMatches) 88 if (!channelCountMatches)
89 return; 89 return;
90 90
91 // The audio thread can't block on this lock, so we call tryLock() instead. 91 // The audio thread can't block on this lock, so we call tryLock() instead.
92 MutexTryLocker tryLocker(m_processLock); 92 MutexTryLocker tryLocker(m_processLock);
93 if (tryLocker.locked()) { 93 if (tryLocker.locked()) {
94 // For each channel of our input, process using the corresponding WaveSh aperDSPKernel into the output channel. 94 // For each channel of our input, process using the corresponding WaveSh aperDSPKernel into the output channel.
95 for (unsigned i = 0; i < m_kernels.size(); ++i) 95 for (unsigned i = 0; i < m_kernels.size(); ++i)
96 m_kernels[i]->process(source->channel(i)->data(), destination->chann el(i)->mutableData(), framesToProcess); 96 m_kernels[i]->process(source->channel(i)->data(), destination->chann el(i)->mutableData(), framesToProcess);
97 } else { 97 } else {
98 // Too bad - the tryLock() failed. We must be in the middle of a setCurv e() call. 98 // Too bad - the tryLock() failed. We must be in the middle of a setCurv e() call.
99 destination->zero(); 99 destination->zero();
100 } 100 }
101 } 101 }
102 102
103 } // namespace blink 103 } // namespace blink
104 104
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/WaveShaperNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698