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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioBus.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 * 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate) 58 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate)
59 : m_length(length), m_busGain(1), m_isFirstTime(true), m_sampleRate(0) { 59 : m_length(length), m_busGain(1), m_isFirstTime(true), m_sampleRate(0) {
60 m_channels.reserveInitialCapacity(numberOfChannels); 60 m_channels.reserveInitialCapacity(numberOfChannels);
61 61
62 for (unsigned i = 0; i < numberOfChannels; ++i) { 62 for (unsigned i = 0; i < numberOfChannels; ++i) {
63 std::unique_ptr<AudioChannel> channel = 63 std::unique_ptr<AudioChannel> channel =
64 allocate ? WTF::wrapUnique(new AudioChannel(length)) 64 allocate ? WTF::wrapUnique(new AudioChannel(length))
65 : WTF::wrapUnique(new AudioChannel(0, length)); 65 : WTF::wrapUnique(new AudioChannel(0, length));
66 m_channels.append(std::move(channel)); 66 m_channels.push_back(std::move(channel));
67 } 67 }
68 68
69 m_layout = LayoutCanonical; // for now this is the only layout we define 69 m_layout = LayoutCanonical; // for now this is the only layout we define
70 } 70 }
71 71
72 void AudioBus::setChannelMemory(unsigned channelIndex, 72 void AudioBus::setChannelMemory(unsigned channelIndex,
73 float* storage, 73 float* storage,
74 size_t length) { 74 size_t length) {
75 if (channelIndex < m_channels.size()) { 75 if (channelIndex < m_channels.size()) {
76 channel(channelIndex)->set(storage, length); 76 channel(channelIndex)->set(storage, length);
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // If the bus needs no conversion then return as is. 758 // If the bus needs no conversion then return as is.
759 if ((!mixToMono || audioBus->numberOfChannels() == 1) && 759 if ((!mixToMono || audioBus->numberOfChannels() == 1) &&
760 audioBus->sampleRate() == sampleRate) 760 audioBus->sampleRate() == sampleRate)
761 return audioBus; 761 return audioBus;
762 762
763 return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono, 763 return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono,
764 sampleRate); 764 sampleRate);
765 } 765 }
766 766
767 } // namespace blink 767 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698