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

Side by Side Diff: third_party/WebKit/Source/platform/audio/MultiChannelResampler.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 : m_multiChannelProvider(multiChannelProvider), 44 : m_multiChannelProvider(multiChannelProvider),
45 m_numberOfChannels(numberOfChannels), 45 m_numberOfChannels(numberOfChannels),
46 m_currentChannel(0), 46 m_currentChannel(0),
47 m_framesToProcess(0) {} 47 m_framesToProcess(0) {}
48 48
49 // provideInput() will be called once for each channel, starting with the 49 // provideInput() will be called once for each channel, starting with the
50 // first channel. Each time it's called, it will provide the next channel of 50 // first channel. Each time it's called, it will provide the next channel of
51 // data. 51 // data.
52 void provideInput(AudioBus* bus, size_t framesToProcess) override { 52 void provideInput(AudioBus* bus, size_t framesToProcess) override {
53 bool isBusGood = bus && bus->numberOfChannels() == 1; 53 bool isBusGood = bus && bus->numberOfChannels() == 1;
54 ASSERT(isBusGood); 54 DCHECK(isBusGood);
55 if (!isBusGood) 55 if (!isBusGood)
56 return; 56 return;
57 57
58 // Get the data from the multi-channel provider when the first channel asks 58 // Get the data from the multi-channel provider when the first channel asks
59 // for it. For subsequent channels, we can just dish out the channel data 59 // for it. For subsequent channels, we can just dish out the channel data
60 // from that (stored in m_multiChannelBus). 60 // from that (stored in m_multiChannelBus).
61 if (!m_currentChannel) { 61 if (!m_currentChannel) {
62 m_framesToProcess = framesToProcess; 62 m_framesToProcess = framesToProcess;
63 m_multiChannelBus = AudioBus::create(m_numberOfChannels, framesToProcess); 63 m_multiChannelBus = AudioBus::create(m_numberOfChannels, framesToProcess);
64 m_multiChannelProvider->provideInput(m_multiChannelBus.get(), 64 m_multiChannelProvider->provideInput(m_multiChannelBus.get(),
65 framesToProcess); 65 framesToProcess);
66 } 66 }
67 67
68 // All channels must ask for the same amount. This should always be the 68 // All channels must ask for the same amount. This should always be the
69 // case, but let's just make sure. 69 // case, but let's just make sure.
70 bool isGood = 70 bool isGood =
71 m_multiChannelBus.get() && framesToProcess == m_framesToProcess; 71 m_multiChannelBus.get() && framesToProcess == m_framesToProcess;
72 ASSERT(isGood); 72 DCHECK(isGood);
73 if (!isGood) 73 if (!isGood)
74 return; 74 return;
75 75
76 // Copy the channel data from what we received from m_multiChannelProvider. 76 // Copy the channel data from what we received from m_multiChannelProvider.
77 ASSERT(m_currentChannel <= m_numberOfChannels); 77 ASSERT(m_currentChannel <= m_numberOfChannels);
78 if (m_currentChannel < m_numberOfChannels) { 78 if (m_currentChannel < m_numberOfChannels) {
79 memcpy(bus->channel(0)->mutableData(), 79 memcpy(bus->channel(0)->mutableData(),
80 m_multiChannelBus->channel(m_currentChannel)->data(), 80 m_multiChannelBus->channel(m_currentChannel)->data(),
81 sizeof(float) * framesToProcess); 81 sizeof(float) * framesToProcess);
82 ++m_currentChannel; 82 ++m_currentChannel;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // calls provideInput() for the first channel, then it will call it for the 120 // calls provideInput() for the first channel, then it will call it for the
121 // remaining channels, since they all buffer in the same way and are 121 // remaining channels, since they all buffer in the same way and are
122 // processing the same number of frames. 122 // processing the same number of frames.
123 m_kernels[channelIndex]->process( 123 m_kernels[channelIndex]->process(
124 &channelProvider, destination->channel(channelIndex)->mutableData(), 124 &channelProvider, destination->channel(channelIndex)->mutableData(),
125 framesToProcess); 125 framesToProcess);
126 } 126 }
127 } 127 }
128 128
129 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/IIRFilter.cpp ('k') | third_party/WebKit/Source/platform/audio/Reverb.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698