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

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

Issue 1657763002: Handle NaN in the Audio delay curves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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) 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 if (m_firstTime) { 113 if (m_firstTime) {
114 m_currentDelayTime = delayTime; 114 m_currentDelayTime = delayTime;
115 m_firstTime = false; 115 m_firstTime = false;
116 } 116 }
117 } 117 }
118 118
119 for (unsigned i = 0; i < framesToProcess; ++i) { 119 for (unsigned i = 0; i < framesToProcess; ++i) {
120 if (sampleAccurate) { 120 if (sampleAccurate) {
121 delayTime = delayTimes[i]; 121 delayTime = delayTimes[i];
122 delayTime = clampTo(delayTime, 0.0, maxTime); 122 if (std::isnan(delayTime))
123 delayTime = maxTime;
124 else
125 delayTime = clampTo(delayTime, 0.0, maxTime);
123 m_currentDelayTime = delayTime; 126 m_currentDelayTime = delayTime;
124 } else { 127 } else {
125 // Approach desired delay time. 128 // Approach desired delay time.
126 m_currentDelayTime += (delayTime - m_currentDelayTime) * m_smoothing Rate; 129 m_currentDelayTime += (delayTime - m_currentDelayTime) * m_smoothing Rate;
127 } 130 }
128 131
129 double desiredDelayFrames = m_currentDelayTime * sampleRate; 132 double desiredDelayFrames = m_currentDelayTime * sampleRate;
130 133
131 double readPosition = m_writeIndex + bufferLength - desiredDelayFrames; 134 double readPosition = m_writeIndex + bufferLength - desiredDelayFrames;
132 if (readPosition >= bufferLength) 135 if (readPosition >= bufferLength)
(...skipping 30 matching lines...) Expand all
163 return m_maxDelayTime; 166 return m_maxDelayTime;
164 } 167 }
165 168
166 double AudioDelayDSPKernel::latencyTime() const 169 double AudioDelayDSPKernel::latencyTime() const
167 { 170 {
168 return 0; 171 return 0;
169 } 172 }
170 173
171 } // namespace blink 174 } // namespace blink
172 175
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698