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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioDestination.h

Issue 2582443004: ScriptProcessor buffer size should be consistent with callback size (Closed)
Patch Set: Created 4 years 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // WebAudioDevice::RenderCallback 82 // WebAudioDevice::RenderCallback
83 void render(const WebVector<float*>& sourceData, 83 void render(const WebVector<float*>& sourceData,
84 const WebVector<float*>& audioData, 84 const WebVector<float*>& audioData,
85 size_t numberOfFrames) override; 85 size_t numberOfFrames) override;
86 86
87 // AudioSourceProvider 87 // AudioSourceProvider
88 void provideInput(AudioBus*, size_t framesToProcess) override; 88 void provideInput(AudioBus*, size_t framesToProcess) override;
89 89
90 static float hardwareSampleRate(); 90 static float hardwareSampleRate();
91 91
92 size_t callbackBufferSize() const { return m_callbackBufferSize; }
93
92 // maxChannelCount() returns the total number of output channels of the audio 94 // maxChannelCount() returns the total number of output channels of the audio
93 // hardware. A value of 0 indicates that the number of channels cannot be 95 // hardware. A value of 0 indicates that the number of channels cannot be
94 // configured and that only stereo (2-channel) destinations can be created. 96 // configured and that only stereo (2-channel) destinations can be created.
95 // The numberOfOutputChannels parameter of AudioDestination::create() is 97 // The numberOfOutputChannels parameter of AudioDestination::create() is
96 // allowed to be a value: 1 <= numberOfOutputChannels <= maxChannelCount(), 98 // allowed to be a value: 1 <= numberOfOutputChannels <= maxChannelCount(),
97 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2. 99 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2.
98 static unsigned long maxChannelCount(); 100 static unsigned long maxChannelCount();
99 101
100 private: 102 private:
101 AudioIOCallback& m_callback; 103 AudioIOCallback& m_callback;
102 unsigned m_numberOfOutputChannels; 104 unsigned m_numberOfOutputChannels;
103 RefPtr<AudioBus> m_inputBus; 105 RefPtr<AudioBus> m_inputBus;
104 RefPtr<AudioBus> m_renderBus; 106 RefPtr<AudioBus> m_renderBus;
105 float m_sampleRate; 107 float m_sampleRate;
106 bool m_isPlaying; 108 bool m_isPlaying;
107 std::unique_ptr<WebAudioDevice> m_audioDevice; 109 std::unique_ptr<WebAudioDevice> m_audioDevice;
108 size_t m_callbackBufferSize; 110 size_t m_callbackBufferSize;
109 111
110 std::unique_ptr<AudioFIFO> m_inputFifo; 112 std::unique_ptr<AudioFIFO> m_inputFifo;
111 std::unique_ptr<AudioPullFIFO> m_fifo; 113 std::unique_ptr<AudioPullFIFO> m_fifo;
112 }; 114 };
113 115
114 } // namespace blink 116 } // namespace blink
115 117
116 #endif // AudioDestination_h 118 #endif // AudioDestination_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698