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

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: 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) 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) 72 void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess)
73 { 73 {
74 if (!isInitialized()) { 74 if (!isInitialized()) {
75 destination->zero(); 75 destination->zero();
76 return; 76 return;
77 } 77 }
78 78
79 bool channelCountMatches = source->numberOfChannels() == destination->number OfChannels() && source->numberOfChannels() == m_kernels.size(); 79 bool channelCountMatches = source->numberOfChannels() == destination->number OfChannels() && source->numberOfChannels() == m_kernels.size();
80 ASSERT(channelCountMatches); 80 DCHECK(channelCountMatches);
81 if (!channelCountMatches) 81 if (!channelCountMatches)
82 return; 82 return;
83 83
84 // The audio thread can't block on this lock, so we call tryLock() instead. 84 // The audio thread can't block on this lock, so we call tryLock() instead.
85 MutexTryLocker tryLocker(m_processLock); 85 MutexTryLocker tryLocker(m_processLock);
86 if (tryLocker.locked()) { 86 if (tryLocker.locked()) {
87 // For each channel of our input, process using the corresponding WaveSh aperDSPKernel into the output channel. 87 // For each channel of our input, process using the corresponding WaveSh aperDSPKernel into the output channel.
88 for (unsigned i = 0; i < m_kernels.size(); ++i) 88 for (unsigned i = 0; i < m_kernels.size(); ++i)
89 m_kernels[i]->process(source->channel(i)->data(), destination->chann el(i)->mutableData(), framesToProcess); 89 m_kernels[i]->process(source->channel(i)->data(), destination->chann el(i)->mutableData(), framesToProcess);
90 } else { 90 } else {
91 // Too bad - the tryLock() failed. We must be in the middle of a setCurv e() call. 91 // Too bad - the tryLock() failed. We must be in the middle of a setCurv e() call.
92 destination->zero(); 92 destination->zero();
93 } 93 }
94 } 94 }
95 95
96 } // namespace blink 96 } // namespace blink
97 97
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698