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

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

Issue 2803733002: Convert ASSERT(foo) to DCHECK(foo) in platform/audio (Closed)
Patch Set: Mechanical change from ASSERT(foo) to DCHECK(foo) Created 3 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // In a sense, this is shifting forward in time by one sample-frame at the 74 // In a sense, this is shifting forward in time by one sample-frame at the
75 // destination sample-rate. 75 // destination sample-rate.
76 m_reducedKernel[(i - 1) / 2] = sinc * window; 76 m_reducedKernel[(i - 1) / 2] = sinc * window;
77 } 77 }
78 } 78 }
79 79
80 void DownSampler::process(const float* sourceP, 80 void DownSampler::process(const float* sourceP,
81 float* destP, 81 float* destP,
82 size_t sourceFramesToProcess) { 82 size_t sourceFramesToProcess) {
83 bool isInputBlockSizeGood = sourceFramesToProcess == m_inputBlockSize; 83 bool isInputBlockSizeGood = sourceFramesToProcess == m_inputBlockSize;
84 ASSERT(isInputBlockSizeGood); 84 DCHECK(isInputBlockSizeGood);
85 if (!isInputBlockSizeGood) 85 if (!isInputBlockSizeGood)
86 return; 86 return;
87 87
88 size_t destFramesToProcess = sourceFramesToProcess / 2; 88 size_t destFramesToProcess = sourceFramesToProcess / 2;
89 89
90 bool isTempBufferGood = destFramesToProcess == m_tempBuffer.size(); 90 bool isTempBufferGood = destFramesToProcess == m_tempBuffer.size();
91 ASSERT(isTempBufferGood); 91 DCHECK(isTempBufferGood);
92 if (!isTempBufferGood) 92 if (!isTempBufferGood)
93 return; 93 return;
94 94
95 bool isReducedKernelGood = m_reducedKernel.size() == DefaultKernelSize / 2; 95 bool isReducedKernelGood = m_reducedKernel.size() == DefaultKernelSize / 2;
96 ASSERT(isReducedKernelGood); 96 DCHECK(isReducedKernelGood);
97 if (!isReducedKernelGood) 97 if (!isReducedKernelGood)
98 return; 98 return;
99 99
100 size_t halfSize = DefaultKernelSize / 2; 100 size_t halfSize = DefaultKernelSize / 2;
101 101
102 // Copy source samples to 2nd half of input buffer. 102 // Copy source samples to 2nd half of input buffer.
103 bool isInputBufferGood = m_inputBuffer.size() == sourceFramesToProcess * 2 && 103 bool isInputBufferGood = m_inputBuffer.size() == sourceFramesToProcess * 2 &&
104 halfSize <= sourceFramesToProcess; 104 halfSize <= sourceFramesToProcess;
105 ASSERT(isInputBufferGood); 105 DCHECK(isInputBufferGood);
106 if (!isInputBufferGood) 106 if (!isInputBufferGood)
107 return; 107 return;
108 108
109 float* inputP = m_inputBuffer.data() + sourceFramesToProcess; 109 float* inputP = m_inputBuffer.data() + sourceFramesToProcess;
110 memcpy(inputP, sourceP, sizeof(float) * sourceFramesToProcess); 110 memcpy(inputP, sourceP, sizeof(float) * sourceFramesToProcess);
111 111
112 // Copy the odd sample-frames from sourceP, delayed by one sample-frame 112 // Copy the odd sample-frames from sourceP, delayed by one sample-frame
113 // (destination sample-rate) to match shifting forward in time in 113 // (destination sample-rate) to match shifting forward in time in
114 // m_reducedKernel. 114 // m_reducedKernel.
115 float* oddSamplesP = m_tempBuffer.data(); 115 float* oddSamplesP = m_tempBuffer.data();
(...skipping 23 matching lines...) Expand all
139 m_inputBuffer.zero(); 139 m_inputBuffer.zero();
140 } 140 }
141 141
142 size_t DownSampler::latencyFrames() const { 142 size_t DownSampler::latencyFrames() const {
143 // Divide by two since this is a linear phase kernel and the delay is at the 143 // Divide by two since this is a linear phase kernel and the delay is at the
144 // center of the kernel. 144 // center of the kernel.
145 return m_reducedKernel.size() / 2; 145 return m_reducedKernel.size() / 2;
146 } 146 }
147 147
148 } // namespace blink 148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698