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

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

Issue 1596523005: Drop WebRTC audio data if OS has skipped frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Smaller fixes. Created 4 years, 11 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
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 "base/macros.h" 9 #include "base/macros.h"
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // Consumes |frames_to_consume| audio frames from the FIFO and copies 35 // Consumes |frames_to_consume| audio frames from the FIFO and copies
36 // them to |destination|. If the FIFO does not have enough data, we ask 36 // them to |destination|. If the FIFO does not have enough data, we ask
37 // the producer to give us more data to fulfill the request using the 37 // the producer to give us more data to fulfill the request using the
38 // ReadCB implementation. 38 // ReadCB implementation.
39 void Consume(AudioBus* destination, int frames_to_consume); 39 void Consume(AudioBus* destination, int frames_to_consume);
40 40
41 // Empties the FIFO without deallocating any memory. 41 // Empties the FIFO without deallocating any memory.
42 void Clear(); 42 void Clear();
43 43
44 // Returns the size of the fifo in number of frames.
45 int SizeInFrames();
46
44 private: 47 private:
45 // Attempt to fulfill the request using what is available in the FIFO. 48 // Attempt to fulfill the request using what is available in the FIFO.
46 // Append new data to the |destination| starting at |write_pos|. 49 // Append new data to the |destination| starting at |write_pos|.
47 int ReadFromFifo(AudioBus* destination, int frames_to_provide, int write_pos); 50 int ReadFromFifo(AudioBus* destination, int frames_to_provide, int write_pos);
48 51
49 // Source of data to the FIFO. 52 // Source of data to the FIFO.
50 const ReadCB read_cb_; 53 const ReadCB read_cb_;
51 54
52 // Temporary audio bus to hold the data from the producer. 55 // Temporary audio bus to hold the data from the producer.
53 scoped_ptr<AudioBus> fifo_; 56 scoped_ptr<AudioBus> fifo_;
54 int fifo_index_; 57 int fifo_index_;
55 58
56 DISALLOW_COPY_AND_ASSIGN(AudioPullFifo); 59 DISALLOW_COPY_AND_ASSIGN(AudioPullFifo);
57 }; 60 };
58 61
59 } // namespace media 62 } // namespace media
60 63
61 #endif // MEDIA_BASE_AUDIO_PULL_FIFO_H_ 64 #endif // MEDIA_BASE_AUDIO_PULL_FIFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698