Index: third_party/WebKit/Source/platform/audio/AudioPullFIFO.h |
diff --git a/third_party/WebKit/Source/platform/audio/AudioPullFIFO.h b/third_party/WebKit/Source/platform/audio/AudioPullFIFO.h |
index 015eeac98ed4ec1e71769f0ebffb37445fe6708d..a81b341f93471f3c05d4cc06ef3da339ca08620d 100644 |
--- a/third_party/WebKit/Source/platform/audio/AudioPullFIFO.h |
+++ b/third_party/WebKit/Source/platform/audio/AudioPullFIFO.h |
@@ -36,40 +36,52 @@ |
namespace blink { |
-// A FIFO (First In First Out) buffer to handle mismatches in buffer sizes between a provider and |
-// receiver. The receiver will "pull" data from this FIFO. If data is already available in the |
-// FIFO, it is provided to the receiver. If insufficient data is available to satisfy the request, |
-// the FIFO will ask the provider for more data when necessary to fulfill a request. Contrast this |
-// with a "push" FIFO, where the sender pushes data to the FIFO which will itself push the data to |
-// the receiver when the FIFO is full. |
+// A FIFO (First In First Out) buffer to handle mismatches in buffer sizes |
+// between a provider and consumer. The consumer will "pull" data from this |
+// FIFO. If data is already available in the FIFO, it is provided to the |
+// consumer. If available data is insufficient to satisfy the request, the FIFO |
+// will ask the provider for more data until it is enough to fulfill a request. |
+// |
+// Provider (e.g destination node) |
+// | (pull) |
+// v |
+// AudioPullFIFO |
+// | (consume) |
+// v |
+// Consumer (e.g. AudioRenderSink) |
+// |
class PLATFORM_EXPORT AudioPullFIFO { |
USING_FAST_MALLOC(AudioPullFIFO); |
WTF_MAKE_NONCOPYABLE(AudioPullFIFO); |
+ |
public: |
- // Create a FIFO that gets data from |provider|. The FIFO will be large enough to hold |
- // |fifoLength| frames of data of |numberOfChannels| channels. The AudioSourceProvider will be |
- // asked to produce |providerSize| frames when the FIFO needs more data. |
- AudioPullFIFO(AudioSourceProvider& audioProvider, unsigned numberOfChannels, size_t fifoLength, size_t providerSize); |
+ // Create a FIFO that gets data from |provider|. The FIFO will be large |
+ // enough to hold |fifoBufferLength| frames of data of |numberOfChannels| |
+ // channels. The AudioSourceProvider will be asked to produce |
+ // |providerRenderBlockSize| frames when the FIFO needs more data. |
+ AudioPullFIFO(unsigned numberOfChannels, size_t fifoBufferLength, AudioSourceProvider&, size_t providerRenderBlockSize); |
- // Read |framesToConsume| frames from the FIFO into the destination. If the FIFO does not have |
- // enough data, we ask the |provider| to get more data to fulfill the request. |
+ // Read |framesToConsume| frames from the FIFO into the destination. If the |
+ // FIFO does not have enough data, it asks the |provider| to get more data |
+ // to fulfill the request. |
void consume(AudioBus* destination, size_t framesToConsume); |
private: |
- // Fill the FIFO buffer with at least |numberOfFrames| more data. |
- void fillBuffer(size_t numberOfFrames); |
+ // Request more data of |numberOfFrames| from provider to fill the FIFO |
+ // buffer. |
+ void requestDataFromProvider(size_t numberOfFrames); |
+ |
+ // Number of frames of data that the provider will produce per call. |
+ unsigned m_providerRenderBlockSize; |
// The provider of the data in our FIFO. |
AudioSourceProvider& m_provider; |
- // The actual FIFO |
- AudioFIFO m_fifo; |
- |
- // Number of frames of data that the provider will produce per call. |
- unsigned m_providerSize; |
- |
- // Temporary workspace to hold the data from the provider. |
+ // Temporary audio bus reference to transfer the data from the provider. |
RefPtr<AudioBus> m_tempBus; |
+ |
+ // The actual FIFO. |
+ AudioFIFO m_fifo; |
}; |
} // namespace blink |