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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 RealtimeAnalyser::RealtimeAnalyser() 50 RealtimeAnalyser::RealtimeAnalyser()
51 : m_inputBuffer(InputBufferSize), 51 : m_inputBuffer(InputBufferSize),
52 m_writeIndex(0), 52 m_writeIndex(0),
53 m_downMixBus(AudioBus::create(1, AudioUtilities::kRenderQuantumFrames)), 53 m_downMixBus(AudioBus::create(1, AudioUtilities::kRenderQuantumFrames)),
54 m_fftSize(DefaultFFTSize), 54 m_fftSize(DefaultFFTSize),
55 m_magnitudeBuffer(DefaultFFTSize / 2), 55 m_magnitudeBuffer(DefaultFFTSize / 2),
56 m_smoothingTimeConstant(DefaultSmoothingTimeConstant), 56 m_smoothingTimeConstant(DefaultSmoothingTimeConstant),
57 m_minDecibels(DefaultMinDecibels), 57 m_minDecibels(DefaultMinDecibels),
58 m_maxDecibels(DefaultMaxDecibels), 58 m_maxDecibels(DefaultMaxDecibels),
59 m_lastAnalysisTime(-1) { 59 m_lastAnalysisTime(-1) {
60 m_analysisFrame = makeUnique<FFTFrame>(DefaultFFTSize); 60 m_analysisFrame = WTF::makeUnique<FFTFrame>(DefaultFFTSize);
61 } 61 }
62 62
63 bool RealtimeAnalyser::setFftSize(size_t size) { 63 bool RealtimeAnalyser::setFftSize(size_t size) {
64 DCHECK(isMainThread()); 64 DCHECK(isMainThread());
65 65
66 // Only allow powers of two. 66 // Only allow powers of two.
67 unsigned log2size = static_cast<unsigned>(log2(size)); 67 unsigned log2size = static_cast<unsigned>(log2(size));
68 bool isPOT(1UL << log2size == size); 68 bool isPOT(1UL << log2size == size);
69 69
70 if (!isPOT || size > MaxFFTSize || size < MinFFTSize) 70 if (!isPOT || size > MaxFFTSize || size < MinFFTSize)
71 return false; 71 return false;
72 72
73 if (m_fftSize != size) { 73 if (m_fftSize != size) {
74 m_analysisFrame = makeUnique<FFTFrame>(size); 74 m_analysisFrame = WTF::makeUnique<FFTFrame>(size);
75 // m_magnitudeBuffer has size = fftSize / 2 because it contains floats 75 // m_magnitudeBuffer has size = fftSize / 2 because it contains floats
76 // reduced from complex values in m_analysisFrame. 76 // reduced from complex values in m_analysisFrame.
77 m_magnitudeBuffer.allocate(size / 2); 77 m_magnitudeBuffer.allocate(size / 2);
78 m_fftSize = size; 78 m_fftSize = size;
79 } 79 }
80 80
81 return true; 81 return true;
82 } 82 }
83 83
84 void RealtimeAnalyser::writeInput(AudioBus* bus, size_t framesToProcess) { 84 void RealtimeAnalyser::writeInput(AudioBus* bus, size_t framesToProcess) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 scaledValue = 0; 333 scaledValue = 0;
334 if (scaledValue > UCHAR_MAX) 334 if (scaledValue > UCHAR_MAX)
335 scaledValue = UCHAR_MAX; 335 scaledValue = UCHAR_MAX;
336 336
337 destination[i] = static_cast<unsigned char>(scaledValue); 337 destination[i] = static_cast<unsigned char>(scaledValue);
338 } 338 }
339 } 339 }
340 } 340 }
341 341
342 } // namespace blink 342 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698