diff options
author | dalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 01:17:26 +0000 |
---|---|---|
committer | dalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 01:17:26 +0000 |
commit | b61228f455896a0477a51b12b477124f17b489ed (patch) | |
tree | 818dc894801fbfc882c8c1868b9ae1bae66895a6 /media/base/sinc_resampler.h | |
parent | f4b43912285085167847cc9b8a409e4650711469 (diff) | |
download | chromium_src-b61228f455896a0477a51b12b477124f17b489ed.zip chromium_src-b61228f455896a0477a51b12b477124f17b489ed.tar.gz chromium_src-b61228f455896a0477a51b12b477124f17b489ed.tar.bz2 |
Don't use magic statics in SincResampler for thread safe init.
SincResampler uses magic statics for thread safe initialization
of runtime detected SIMD support functions. Sadly, this is not
supported on MSVC++ until VS2012.
Crash reports seem to indicate that every once in a while this
fails on Windows and kConvolveProc ends up initialized to NULL.
This patch moves initializtion from once per renderer to once
per SincResampler construction. Not ideal, but there should
never be very many instantiations of this class. Long term
we'll be moving to an SSE baseline which obviates the runtime
selection process.
BUG=179986
TEST=media_unittests
Review URL: https://chromiumcodereview.appspot.com/12530005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/sinc_resampler.h')
-rw-r--r-- | media/base/sinc_resampler.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/media/base/sinc_resampler.h b/media/base/sinc_resampler.h index f4eaf5f..7b1dfaa 100644 --- a/media/base/sinc_resampler.h +++ b/media/base/sinc_resampler.h @@ -73,8 +73,6 @@ class MEDIA_EXPORT SincResampler { // linearly interpolated using |kernel_interpolation_factor|. On x86, the // underlying implementation is chosen at run time based on SSE support. On // ARM, NEON support is chosen at compile time based on compilation flags. - static float Convolve(const float* input_ptr, const float* k1, - const float* k2, double kernel_interpolation_factor); static float Convolve_C(const float* input_ptr, const float* k1, const float* k2, double kernel_interpolation_factor); #if defined(ARCH_CPU_X86_FAMILY) @@ -108,6 +106,13 @@ class MEDIA_EXPORT SincResampler { // Data from the source is copied into this buffer for each processing pass. scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> input_buffer_; + // Stores the runtime selection of which Convolve function to use. +#if defined(ARCH_CPU_X86_FAMILY) && !defined(__SSE__) + typedef float (*ConvolveProc)(const float*, const float*, const float*, + double); + const ConvolveProc convolve_proc_; +#endif + // Pointers to the various regions inside |input_buffer_|. See the diagram at // the top of the .cc file for more information. float* const r0_; |