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

Side by Side Diff: Source/WebCore/platform/audio/HRTFPanner.cpp

Issue 8231033: Merge 97214 - Heap buffer overflow in Webaudio FFTFrame::doFFT (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « Source/WebCore/platform/audio/HRTFKernel.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 HRTFPanner::~HRTFPanner() 59 HRTFPanner::~HRTFPanner()
60 { 60 {
61 } 61 }
62 62
63 size_t HRTFPanner::fftSizeForSampleRate(double sampleRate) 63 size_t HRTFPanner::fftSizeForSampleRate(double sampleRate)
64 { 64 {
65 // The HRTF impulse responses (loaded as audio resources) are 512 sample-fra mes @44.1KHz. 65 // The HRTF impulse responses (loaded as audio resources) are 512 sample-fra mes @44.1KHz.
66 // Currently, we truncate the impulse responses to half this size, but an FF T-size of twice impulse response size is needed (for convolution). 66 // Currently, we truncate the impulse responses to half this size, but an FF T-size of twice impulse response size is needed (for convolution).
67 // So for sample rates around 44.1KHz an FFT size of 512 is good. We double that size for higher sample rates. 67 // So for sample rates around 44.1KHz an FFT size of 512 is good. We double the FFT-size only for sample rates at least double this.
68 ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0); 68 ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0);
69 return (sampleRate <= 48000.0) ? 512 : 1024; 69 return (sampleRate < 88200.0) ? 512 : 1024;
70 } 70 }
71 71
72 void HRTFPanner::reset() 72 void HRTFPanner::reset()
73 { 73 {
74 m_isFirstRender = true; 74 m_isFirstRender = true;
75 m_convolverL.reset(); 75 m_convolverL.reset();
76 m_convolverR.reset(); 76 m_convolverR.reset();
77 m_delayLineL.reset(); 77 m_delayLineL.reset();
78 m_delayLineR.reset(); 78 m_delayLineR.reset();
79 } 79 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 // Now do the convolutions in-place. 221 // Now do the convolutions in-place.
222 m_convolverL.process(kernelL->fftFrame(), segmentDestinationL, segmentDe stinationL, framesPerSegment); 222 m_convolverL.process(kernelL->fftFrame(), segmentDestinationL, segmentDe stinationL, framesPerSegment);
223 m_convolverR.process(kernelR->fftFrame(), segmentDestinationR, segmentDe stinationR, framesPerSegment); 223 m_convolverR.process(kernelR->fftFrame(), segmentDestinationR, segmentDe stinationR, framesPerSegment);
224 } 224 }
225 } 225 }
226 226
227 } // namespace WebCore 227 } // namespace WebCore
228 228
229 #endif // ENABLE(WEB_AUDIO) 229 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/WebCore/platform/audio/HRTFKernel.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698