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

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

Issue 2334773003: Support sample rates up to 384 kHz. (Closed)
Patch Set: Created 4 years, 3 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Arbitrarly limit the maximum length to 1 million frames (about 20 sec 99 // Arbitrarly limit the maximum length to 1 million frames (about 20 sec
100 // at 48kHz). The number of buckets is fairly arbitrary. 100 // at 48kHz). The number of buckets is fairly arbitrary.
101 DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextLengthHistogram, 101 DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextLengthHistogram,
102 ("WebAudio.OfflineAudioContext.Length", 1, 1000000, 50)); 102 ("WebAudio.OfflineAudioContext.Length", 1, 1000000, 50));
103 // The limits are the min and max AudioBuffer sample rates currently 103 // The limits are the min and max AudioBuffer sample rates currently
104 // supported. We use explicit values here instead of 104 // supported. We use explicit values here instead of
105 // AudioUtilities::minAudioBufferSampleRate() and 105 // AudioUtilities::minAudioBufferSampleRate() and
106 // AudioUtilities::maxAudioBufferSampleRate(). The number of buckets is 106 // AudioUtilities::maxAudioBufferSampleRate(). The number of buckets is
107 // fairly arbitrary. 107 // fairly arbitrary.
108 DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextSampleRateHistogram, 108 DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextSampleRateHistogram,
109 ("WebAudio.OfflineAudioContext.SampleRate", 3000, 192000, 50)); 109 ("WebAudio.OfflineAudioContext.SampleRate", 3000, 384000, 50));
Mark P 2016/09/13 19:06:39 Widening the histogram like this is messy because
Raymond Toy 2016/09/13 20:12:28 Yeah, I suspected it would make a mess of the exis
110 110
111 offlineContextChannelCountHistogram.sample(numberOfChannels); 111 offlineContextChannelCountHistogram.sample(numberOfChannels);
112 offlineContextLengthHistogram.count(numberOfFrames); 112 offlineContextLengthHistogram.count(numberOfFrames);
113 offlineContextSampleRateHistogram.count(sampleRate); 113 offlineContextSampleRateHistogram.count(sampleRate);
114 114
115 audioContext->suspendIfNeeded(); 115 audioContext->suspendIfNeeded();
116 return audioContext; 116 return audioContext;
117 } 117 }
118 118
119 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh annels, size_t numberOfFrames, float sampleRate, ExceptionState& exceptionState) 119 OfflineAudioContext::OfflineAudioContext(Document* document, unsigned numberOfCh annels, size_t numberOfFrames, float sampleRate, ExceptionState& exceptionState)
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // Note that the GraphLock is required before this check. Since this needs 441 // Note that the GraphLock is required before this check. Since this needs
442 // to run on the audio thread, OfflineGraphAutoLocker must be used. 442 // to run on the audio thread, OfflineGraphAutoLocker must be used.
443 if (m_scheduledSuspends.contains(currentSampleFrame())) 443 if (m_scheduledSuspends.contains(currentSampleFrame()))
444 return true; 444 return true;
445 445
446 return false; 446 return false;
447 } 447 }
448 448
449 } // namespace blink 449 } // namespace blink
450 450
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698