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

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

Issue 1981823002: Remove OwnPtr::release() calls in platform/ (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 PassOwnPtr<AudioChannel> HRTFKernel::createImpulseResponse() 93 PassOwnPtr<AudioChannel> HRTFKernel::createImpulseResponse()
94 { 94 {
95 OwnPtr<AudioChannel> channel = adoptPtr(new AudioChannel(fftSize())); 95 OwnPtr<AudioChannel> channel = adoptPtr(new AudioChannel(fftSize()));
96 FFTFrame fftFrame(*m_fftFrame); 96 FFTFrame fftFrame(*m_fftFrame);
97 97
98 // Add leading delay back in. 98 // Add leading delay back in.
99 fftFrame.addConstantGroupDelay(m_frameDelay); 99 fftFrame.addConstantGroupDelay(m_frameDelay);
100 fftFrame.doInverseFFT(channel->mutableData()); 100 fftFrame.doInverseFFT(channel->mutableData());
101 101
102 return channel.release(); 102 return channel;
103 } 103 }
104 104
105 // Interpolates two kernels with x: 0 -> 1 and returns the result. 105 // Interpolates two kernels with x: 0 -> 1 and returns the result.
106 PassOwnPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x) 106 PassOwnPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x)
107 { 107 {
108 ASSERT(kernel1 && kernel2); 108 ASSERT(kernel1 && kernel2);
109 if (!kernel1 || !kernel2) 109 if (!kernel1 || !kernel2)
110 return nullptr; 110 return nullptr;
111 111
112 ASSERT(x >= 0.0 && x < 1.0); 112 ASSERT(x >= 0.0 && x < 1.0);
113 x = clampTo(x, 0.0f, 1.0f); 113 x = clampTo(x, 0.0f, 1.0f);
114 114
115 float sampleRate1 = kernel1->sampleRate(); 115 float sampleRate1 = kernel1->sampleRate();
116 float sampleRate2 = kernel2->sampleRate(); 116 float sampleRate2 = kernel2->sampleRate();
117 ASSERT(sampleRate1 == sampleRate2); 117 ASSERT(sampleRate1 == sampleRate2);
118 if (sampleRate1 != sampleRate2) 118 if (sampleRate1 != sampleRate2)
119 return nullptr; 119 return nullptr;
120 120
121 float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay (); 121 float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay ();
122 122
123 OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kern el1->fftFrame(), *kernel2->fftFrame(), x); 123 OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kern el1->fftFrame(), *kernel2->fftFrame(), x);
124 return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRat e1); 124 return HRTFKernel::create(std::move(interpolatedFrame), frameDelay, sampleRa te1);
125 } 125 }
126 126
127 } // namespace blink 127 } // namespace blink
128 128
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/HRTFElevation.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