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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.cpp

Issue 2420983002: AudioParams with automations must process timelines (Closed)
Patch Set: Fix paths. Created 3 years, 11 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 m_kernels[i]->process(source->channel(i)->data(), 89 m_kernels[i]->process(source->channel(i)->data(),
90 destination->channel(i)->mutableData(), 90 destination->channel(i)->mutableData(),
91 framesToProcess); 91 framesToProcess);
92 } else { 92 } else {
93 // Unfortunately, the kernel is being processed by another thread. 93 // Unfortunately, the kernel is being processed by another thread.
94 // See also ConvolverNode::process(). 94 // See also ConvolverNode::process().
95 destination->zero(); 95 destination->zero();
96 } 96 }
97 } 97 }
98 98
99 void AudioDSPKernelProcessor::processOnlyAudioParams(size_t framesToProcess) {
100 if (!isInitialized())
101 return;
102
103 MutexTryLocker tryLocker(m_processLock);
104 // Only update the AudioParams if we can get the lock. If not, some
105 // other thread is updating the kernels, so we'll have to skip it
106 // this time.
107 if (tryLocker.locked()) {
108 for (unsigned i = 0; i < m_kernels.size(); ++i)
109 m_kernels[i]->processOnlyAudioParams(framesToProcess);
110 }
111 }
112
99 // Resets filter state 113 // Resets filter state
100 void AudioDSPKernelProcessor::reset() { 114 void AudioDSPKernelProcessor::reset() {
101 ASSERT(isMainThread()); 115 ASSERT(isMainThread());
102 if (!isInitialized()) 116 if (!isInitialized())
103 return; 117 return;
104 118
105 // Forces snap to parameter values - first time. 119 // Forces snap to parameter values - first time.
106 // Any processing depending on this value must set it to false at the 120 // Any processing depending on this value must set it to false at the
107 // appropriate time. 121 // appropriate time.
108 m_hasJustReset = true; 122 m_hasJustReset = true;
(...skipping 30 matching lines...) Expand all
139 if (tryLocker.locked()) { 153 if (tryLocker.locked()) {
140 // It is expected that all the kernels have the same latencyTime. 154 // It is expected that all the kernels have the same latencyTime.
141 return !m_kernels.isEmpty() ? m_kernels.front()->latencyTime() : 0; 155 return !m_kernels.isEmpty() ? m_kernels.front()->latencyTime() : 0;
142 } 156 }
143 // Since we don't want to block the Audio Device thread, we return a large 157 // Since we don't want to block the Audio Device thread, we return a large
144 // value instead of trying to acquire the lock. 158 // value instead of trying to acquire the lock.
145 return std::numeric_limits<double>::infinity(); 159 return std::numeric_limits<double>::infinity();
146 } 160 }
147 161
148 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698