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

Side by Side Diff: media/base/audio_pull_fifo.h

Issue 15394003: Remove extra memcpys from AudioPullFifo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix includes. Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « media/base/audio_converter.cc ('k') | media/base/audio_pull_fifo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_AUDIO_PULL_FIFO_H_ 5 #ifndef MEDIA_BASE_AUDIO_PULL_FIFO_H_
6 #define MEDIA_BASE_AUDIO_PULL_FIFO_H_ 6 #define MEDIA_BASE_AUDIO_PULL_FIFO_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "media/base/audio_fifo.h"
10 #include "media/base/media_export.h" 9 #include "media/base/media_export.h"
11 10
12 namespace media { 11 namespace media {
12 class AudioBus;
13 13
14 // A FIFO (First In First Out) buffer to handle mismatches in buffer sizes 14 // A FIFO (First In First Out) buffer to handle mismatches in buffer sizes
15 // between a producer and consumer. The consumer will pull data from this FIFO. 15 // between a producer and consumer. The consumer will pull data from this FIFO.
16 // If data is already available in the FIFO, it is provided to the consumer. 16 // If data is already available in the FIFO, it is provided to the consumer.
17 // If insufficient data is available to satisfy the request, the FIFO will ask 17 // If insufficient data is available to satisfy the request, the FIFO will ask
18 // the producer for more data to fulfill a request. 18 // the producer for more data to fulfill a request.
19 class MEDIA_EXPORT AudioPullFifo { 19 class MEDIA_EXPORT AudioPullFifo {
20 public: 20 public:
21 // Callback type for providing more data into the FIFO. Expects AudioBus 21 // Callback type for providing more data into the FIFO. Expects AudioBus
22 // to be completely filled with data upon return; zero padded if not enough 22 // to be completely filled with data upon return; zero padded if not enough
(...skipping 13 matching lines...) Expand all
36 // the producer to give us more data to fulfill the request using the 36 // the producer to give us more data to fulfill the request using the
37 // ReadCB implementation. 37 // ReadCB implementation.
38 void Consume(AudioBus* destination, int frames_to_consume); 38 void Consume(AudioBus* destination, int frames_to_consume);
39 39
40 // Empties the FIFO without deallocating any memory. 40 // Empties the FIFO without deallocating any memory.
41 void Clear(); 41 void Clear();
42 42
43 private: 43 private:
44 // Attempt to fulfill the request using what is available in the FIFO. 44 // Attempt to fulfill the request using what is available in the FIFO.
45 // Append new data to the |destination| starting at |write_pos|. 45 // Append new data to the |destination| starting at |write_pos|.
46 void ReadFromFifo( 46 int ReadFromFifo(AudioBus* destination, int frames_to_provide, int write_pos);
47 AudioBus* destination, int* frames_to_provide, int* write_pos);
48 47
49 // Source of data to the FIFO. 48 // Source of data to the FIFO.
50 ReadCB read_cb_; 49 const ReadCB read_cb_;
51
52 // The actual FIFO.
53 scoped_ptr<AudioFifo> fifo_;
54 50
55 // Temporary audio bus to hold the data from the producer. 51 // Temporary audio bus to hold the data from the producer.
56 scoped_ptr<AudioBus> bus_; 52 scoped_ptr<AudioBus> fifo_;
53 int fifo_index_;
57 54
58 DISALLOW_COPY_AND_ASSIGN(AudioPullFifo); 55 DISALLOW_COPY_AND_ASSIGN(AudioPullFifo);
59 }; 56 };
60 57
61 } // namespace media 58 } // namespace media
62 59
63 #endif // MEDIA_BASE_AUDIO_PULL_FIFO_H_ 60 #endif // MEDIA_BASE_AUDIO_PULL_FIFO_H_
OLDNEW
« no previous file with comments | « media/base/audio_converter.cc ('k') | media/base/audio_pull_fifo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698