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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioResampler.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) 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } else 56 } else
57 m_kernels.resize(numberOfChannels); 57 m_kernels.resize(numberOfChannels);
58 58
59 // Reconfigure our source bus to the new channel size. 59 // Reconfigure our source bus to the new channel size.
60 m_sourceBus = AudioBus::create(numberOfChannels, 0, false); 60 m_sourceBus = AudioBus::create(numberOfChannels, 0, false);
61 } 61 }
62 62
63 void AudioResampler::process(AudioSourceProvider* provider, 63 void AudioResampler::process(AudioSourceProvider* provider,
64 AudioBus* destinationBus, 64 AudioBus* destinationBus,
65 size_t framesToProcess) { 65 size_t framesToProcess) {
66 ASSERT(provider); 66 DCHECK(provider);
67 if (!provider) 67 if (!provider)
68 return; 68 return;
69 69
70 unsigned numberOfChannels = m_kernels.size(); 70 unsigned numberOfChannels = m_kernels.size();
71 71
72 // Make sure our configuration matches the bus we're rendering to. 72 // Make sure our configuration matches the bus we're rendering to.
73 bool channelsMatch = (destinationBus && 73 bool channelsMatch = (destinationBus &&
74 destinationBus->numberOfChannels() == numberOfChannels); 74 destinationBus->numberOfChannels() == numberOfChannels);
75 ASSERT(channelsMatch); 75 DCHECK(channelsMatch);
76 if (!channelsMatch) 76 if (!channelsMatch)
77 return; 77 return;
78 78
79 // Setup the source bus. 79 // Setup the source bus.
80 for (unsigned i = 0; i < numberOfChannels; ++i) { 80 for (unsigned i = 0; i < numberOfChannels; ++i) {
81 // Figure out how many frames we need to get from the provider, and a 81 // Figure out how many frames we need to get from the provider, and a
82 // pointer to the buffer. 82 // pointer to the buffer.
83 size_t framesNeeded; 83 size_t framesNeeded;
84 float* fillPointer = 84 float* fillPointer =
85 m_kernels[i]->getSourcePointer(framesToProcess, &framesNeeded); 85 m_kernels[i]->getSourcePointer(framesToProcess, &framesNeeded);
86 ASSERT(fillPointer); 86 DCHECK(fillPointer);
87 if (!fillPointer) 87 if (!fillPointer)
88 return; 88 return;
89 89
90 m_sourceBus->setChannelMemory(i, fillPointer, framesNeeded); 90 m_sourceBus->setChannelMemory(i, fillPointer, framesNeeded);
91 } 91 }
92 92
93 // Ask the provider to supply the desired number of source frames. 93 // Ask the provider to supply the desired number of source frames.
94 provider->provideInput(m_sourceBus.get(), m_sourceBus->length()); 94 provider->provideInput(m_sourceBus.get(), m_sourceBus->length());
95 95
96 // Now that we have the source data, resample each channel into the 96 // Now that we have the source data, resample each channel into the
(...skipping 13 matching lines...) Expand all
110 m_rate = std::min(AudioResampler::MaxRate, rate); 110 m_rate = std::min(AudioResampler::MaxRate, rate);
111 } 111 }
112 112
113 void AudioResampler::reset() { 113 void AudioResampler::reset() {
114 unsigned numberOfChannels = m_kernels.size(); 114 unsigned numberOfChannels = m_kernels.size();
115 for (unsigned i = 0; i < numberOfChannels; ++i) 115 for (unsigned i = 0; i < numberOfChannels; ++i)
116 m_kernels[i]->reset(); 116 m_kernels[i]->reset();
117 } 117 }
118 118
119 } // namespace blink 119 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698