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

Unified Diff: third_party/WebKit/Source/platform/audio/AudioDestination.h

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Add baseLatency and fix use of hardwareSampleRate. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/audio/AudioDestination.h
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.h b/third_party/WebKit/Source/platform/audio/AudioDestination.h
index dda3527f57476e3697025958418f64c07573959d..5c62b4fd0ae6368fb4d0f662d2351dc3cb3f94b9 100644
--- a/third_party/WebKit/Source/platform/audio/AudioDestination.h
+++ b/third_party/WebKit/Source/platform/audio/AudioDestination.h
@@ -45,6 +45,7 @@ namespace blink {
class AudioFIFO;
class AudioPullFIFO;
class SecurityOrigin;
+class WebAudioLatencyHint;
// An AudioDestination using Chromium's audio system
@@ -58,7 +59,7 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback,
const String& inputDeviceId,
unsigned numberOfInputChannels,
unsigned numberOfOutputChannels,
- float sampleRate,
+ const WebAudioLatencyHint&,
PassRefPtr<SecurityOrigin>);
~AudioDestination() override;
@@ -70,14 +71,20 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback,
const String& inputDeviceId,
unsigned numberOfInputChannels,
unsigned numberOfOutputChannels,
- float sampleRate,
+ const WebAudioLatencyHint&,
PassRefPtr<SecurityOrigin>);
virtual void start();
virtual void stop();
bool isPlaying() { return m_isPlaying; }
- float sampleRate() const { return m_sampleRate; }
+ double sampleRate() const {
+ return m_audioDevice ? m_audioDevice->sampleRate() : 0;
o1ka 2016/11/30 11:46:27 Here and below: if |m_audioDevice| being nullptr i
Raymond Toy 2016/11/30 21:50:27 I agree with this. Plus there's already an ASSERT
Andrew MacPherson 2016/12/01 12:11:56 Done.
+ }
+
+ int framesPerBuffer() const {
+ return m_audioDevice ? m_audioDevice->framesPerBuffer() : 0;
+ }
// WebAudioDevice::RenderCallback
void render(const WebVector<float*>& sourceData,
@@ -102,7 +109,6 @@ class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback,
unsigned m_numberOfOutputChannels;
RefPtr<AudioBus> m_inputBus;
RefPtr<AudioBus> m_renderBus;
- float m_sampleRate;
bool m_isPlaying;
std::unique_ptr<WebAudioDevice> m_audioDevice;
size_t m_callbackBufferSize;

Powered by Google App Engine
This is Rietveld 408576698