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

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

Issue 155193: BufferQueue class to hide audio data micromanagement from scaling algorithms. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « no previous file | media/base/buffer_queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 // BufferQueue is a simple Buffer manager that handles requests for data
6 // while hiding Buffer boundaries, treating its internal queue of Buffers
7 // as a contiguous region.
8 //
9 // This class is not threadsafe and requires external locking.
10
11 #ifndef MEDIA_BASE_BUFFER_QUEUE_H_
12 #define MEDIA_BASE_BUFFER_QUEUE_H_
13
14 #include <deque>
15
16 #include "base/ref_counted.h"
17
18 namespace media {
19
20 class Buffer;
21
22 class BufferQueue {
23 public:
24 BufferQueue();
25 ~BufferQueue();
26
27 // Clears |queue_|.
28 void Clear();
29
30 // Advances front pointer |bytes_to_be_consumed| bytes and discards
31 // "consumed" buffers.
32 void Consume(size_t bytes_to_be_consumed);
33
34 // Tries to copy |bytes| bytes from our data to |dest|. Returns the number
35 // of bytes successfully copied.
36 size_t Copy(uint8* dest, size_t bytes);
37
38 // Enqueues |buffer_in| and adds a reference.
39 void Enqueue(Buffer* buffer_in);
40
41 // Returns true if the |queue_| is empty.
42 bool IsEmpty();
43
44 // Returns the number of bytes in the |queue_|.
45 size_t SizeInBytes();
46
47 private:
48 // Queued audio data.
49 std::deque< scoped_refptr<Buffer> > queue_;
50
51 // Remembers the amount of remaining audio data in the front buffer.
52 size_t data_offset_;
53
54 // Keeps track of the |queue_| size in bytes.
55 size_t size_in_bytes_;
56
57 DISALLOW_COPY_AND_ASSIGN(BufferQueue);
58 };
59
60 } // namespace media
61
62 #endif // MEDIA_BASE_BUFFER_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698