OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef PushPullFIFO_h | |
6 #define PushPullFIFO_h | |
7 | |
8 #include "platform/audio/AudioBus.h" | |
9 #include "wtf/Allocator.h" | |
10 | |
11 namespace blink { | |
12 | |
13 class PushPullFIFO { | |
14 USING_FAST_MALLOC(PushPullFIFO); | |
15 WTF_MAKE_NONCOPYABLE(PushPullFIFO); | |
16 | |
17 public: | |
18 PushPullFIFO(unsigned numberOfChannels, size_t length); | |
19 ~PushPullFIFO(); | |
20 | |
21 // Pushing audio data is done by the WebAudio render-backing thread. The | |
22 // priority of this thread is lower than the actual audio device thread, | |
23 // thus the thread can be blocked when the audio device thread is pulling | |
24 // data from the FIFO. | |
25 void push(const AudioBus* inputBus); | |
26 | |
27 // Pulling audio data is done by the audio device thread. This process must | |
28 // be non-blocking to ensure the glitch-less audio playback. | |
29 void pull(AudioBus* outputBus, size_t framesToPull); | |
o1ka
2017/01/09 14:09:03
How do you plan to ensure thread safety?
hongchan
2017/01/09 21:53:16
I believe this FIFO should give the higher priorit
| |
30 | |
31 size_t numberOfFrames() const { return m_numberOfFrames; } | |
32 | |
33 private: | |
34 RefPtr<AudioBus> m_dataBus; | |
Raymond Toy
2017/01/06 22:22:03
Maybe m_fifoDataBus?
hongchan
2017/01/09 21:53:16
Done.
| |
35 | |
36 size_t m_length; | |
37 size_t m_numberOfFrames; | |
38 size_t m_indexRead; | |
39 size_t m_indexWrite; | |
Raymond Toy
2017/01/06 22:22:03
Please document what all of these mean. If m_leng
hongchan
2017/01/09 21:53:16
Done.
AudioBus uses the term 'length'. The FIFO
| |
40 }; | |
41 | |
42 } // namespace blink | |
43 | |
44 #endif // PushPullFIFO_h | |
OLD | NEW |