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

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

Issue 2839063003: Implement tail processing for AudioNodes (Closed)
Patch Set: Make declaration order consistent Created 3 years, 5 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 void AudioDSPKernelProcessor::SetNumberOfChannels(unsigned number_of_channels) { 130 void AudioDSPKernelProcessor::SetNumberOfChannels(unsigned number_of_channels) {
131 if (number_of_channels == number_of_channels_) 131 if (number_of_channels == number_of_channels_)
132 return; 132 return;
133 133
134 DCHECK(!IsInitialized()); 134 DCHECK(!IsInitialized());
135 if (!IsInitialized()) 135 if (!IsInitialized())
136 number_of_channels_ = number_of_channels; 136 number_of_channels_ = number_of_channels;
137 } 137 }
138 138
139 bool AudioDSPKernelProcessor::RequiresTailProcessing() const {
140 // Always return true even if the tail time and latency might both
141 // be zero.
142 return true;
143 }
144
139 double AudioDSPKernelProcessor::TailTime() const { 145 double AudioDSPKernelProcessor::TailTime() const {
140 DCHECK(!IsMainThread()); 146 DCHECK(!IsMainThread());
141 MutexTryLocker try_locker(process_lock_); 147 MutexTryLocker try_locker(process_lock_);
142 if (try_locker.Locked()) { 148 if (try_locker.Locked()) {
143 // It is expected that all the kernels have the same tailTime. 149 // It is expected that all the kernels have the same tailTime.
144 return !kernels_.IsEmpty() ? kernels_.front()->TailTime() : 0; 150 return !kernels_.IsEmpty() ? kernels_.front()->TailTime() : 0;
145 } 151 }
146 // Since we don't want to block the Audio Device thread, we return a large 152 // Since we don't want to block the Audio Device thread, we return a large
147 // value instead of trying to acquire the lock. 153 // value instead of trying to acquire the lock.
148 return std::numeric_limits<double>::infinity(); 154 return std::numeric_limits<double>::infinity();
149 } 155 }
150 156
151 double AudioDSPKernelProcessor::LatencyTime() const { 157 double AudioDSPKernelProcessor::LatencyTime() const {
152 DCHECK(!IsMainThread()); 158 DCHECK(!IsMainThread());
153 MutexTryLocker try_locker(process_lock_); 159 MutexTryLocker try_locker(process_lock_);
154 if (try_locker.Locked()) { 160 if (try_locker.Locked()) {
155 // It is expected that all the kernels have the same latencyTime. 161 // It is expected that all the kernels have the same latencyTime.
156 return !kernels_.IsEmpty() ? kernels_.front()->LatencyTime() : 0; 162 return !kernels_.IsEmpty() ? kernels_.front()->LatencyTime() : 0;
157 } 163 }
158 // Since we don't want to block the Audio Device thread, we return a large 164 // Since we don't want to block the Audio Device thread, we return a large
159 // value instead of trying to acquire the lock. 165 // value instead of trying to acquire the lock.
160 return std::numeric_limits<double>::infinity(); 166 return std::numeric_limits<double>::infinity();
161 } 167 }
162 168
163 } // namespace blink 169 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698