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

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

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 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 15 matching lines...) Expand all
26 #include "platform/audio/AudioResampler.h" 26 #include "platform/audio/AudioResampler.h"
27 #include "wtf/MathExtras.h" 27 #include "wtf/MathExtras.h"
28 #include "wtf/PtrUtil.h" 28 #include "wtf/PtrUtil.h"
29 #include <algorithm> 29 #include <algorithm>
30 30
31 namespace blink { 31 namespace blink {
32 32
33 const double AudioResampler::MaxRate = 8.0; 33 const double AudioResampler::MaxRate = 8.0;
34 34
35 AudioResampler::AudioResampler() : m_rate(1.0) { 35 AudioResampler::AudioResampler() : m_rate(1.0) {
36 m_kernels.append(WTF::makeUnique<AudioResamplerKernel>(this)); 36 m_kernels.push_back(WTF::makeUnique<AudioResamplerKernel>(this));
37 m_sourceBus = AudioBus::create(1, 0, false); 37 m_sourceBus = AudioBus::create(1, 0, false);
38 } 38 }
39 39
40 AudioResampler::AudioResampler(unsigned numberOfChannels) : m_rate(1.0) { 40 AudioResampler::AudioResampler(unsigned numberOfChannels) : m_rate(1.0) {
41 for (unsigned i = 0; i < numberOfChannels; ++i) 41 for (unsigned i = 0; i < numberOfChannels; ++i)
42 m_kernels.append(WTF::makeUnique<AudioResamplerKernel>(this)); 42 m_kernels.push_back(WTF::makeUnique<AudioResamplerKernel>(this));
43 43
44 m_sourceBus = AudioBus::create(numberOfChannels, 0, false); 44 m_sourceBus = AudioBus::create(numberOfChannels, 0, false);
45 } 45 }
46 46
47 void AudioResampler::configureChannels(unsigned numberOfChannels) { 47 void AudioResampler::configureChannels(unsigned numberOfChannels) {
48 unsigned currentSize = m_kernels.size(); 48 unsigned currentSize = m_kernels.size();
49 if (numberOfChannels == currentSize) 49 if (numberOfChannels == currentSize)
50 return; // already setup 50 return; // already setup
51 51
52 // First deal with adding or removing kernels. 52 // First deal with adding or removing kernels.
53 if (numberOfChannels > currentSize) { 53 if (numberOfChannels > currentSize) {
54 for (unsigned i = currentSize; i < numberOfChannels; ++i) 54 for (unsigned i = currentSize; i < numberOfChannels; ++i)
55 m_kernels.append(WTF::makeUnique<AudioResamplerKernel>(this)); 55 m_kernels.push_back(WTF::makeUnique<AudioResamplerKernel>(this));
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) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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