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

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

Issue 2807593003: Revert of Convert RELEASE_ASSERT()/ASSERT(...) to CHECK()/DCHECK_op(...) in platform/audio (Closed)
Patch Set: 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer. 150 // BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer.
151 151
152 class BufferSourceProvider final : public AudioSourceProvider { 152 class BufferSourceProvider final : public AudioSourceProvider {
153 public: 153 public:
154 BufferSourceProvider(const float* source, size_t numberOfSourceFrames) 154 BufferSourceProvider(const float* source, size_t numberOfSourceFrames)
155 : m_source(source), m_sourceFramesAvailable(numberOfSourceFrames) {} 155 : m_source(source), m_sourceFramesAvailable(numberOfSourceFrames) {}
156 156
157 // Consumes samples from the in-memory buffer. 157 // Consumes samples from the in-memory buffer.
158 void provideInput(AudioBus* bus, size_t framesToProcess) override { 158 void provideInput(AudioBus* bus, size_t framesToProcess) override {
159 DCHECK(m_source); 159 ASSERT(m_source && bus);
160 DCHECK(bus);
161 if (!m_source || !bus) 160 if (!m_source || !bus)
162 return; 161 return;
163 162
164 float* buffer = bus->channel(0)->mutableData(); 163 float* buffer = bus->channel(0)->mutableData();
165 164
166 // Clamp to number of frames available and zero-pad. 165 // Clamp to number of frames available and zero-pad.
167 size_t framesToCopy = std::min(m_sourceFramesAvailable, framesToProcess); 166 size_t framesToCopy = std::min(m_sourceFramesAvailable, framesToProcess);
168 memcpy(buffer, m_source, sizeof(float) * framesToCopy); 167 memcpy(buffer, m_source, sizeof(float) * framesToCopy);
169 168
170 // Zero-pad if necessary. 169 // Zero-pad if necessary.
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2)); 474 memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2));
476 memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2)); 475 memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2));
477 476
478 // Step (4) 477 // Step (4)
479 // Refresh the buffer with more input. 478 // Refresh the buffer with more input.
480 consumeSource(r5, m_blockSize); 479 consumeSource(r5, m_blockSize);
481 } 480 }
482 } 481 }
483 482
484 } // namespace blink 483 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698