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

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

Issue 155695: Replace the guts of AudioRendererBase with calls to scaling algorithm. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | « chrome/renderer/media/audio_renderer_impl.cc ('k') | 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')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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 // BufferQueue is a simple Buffer manager that handles requests for data 5 // BufferQueue is a simple Buffer manager that handles requests for data
6 // while hiding Buffer boundaries, treating its internal queue of Buffers 6 // while hiding Buffer boundaries, treating its internal queue of Buffers
7 // as a contiguous region. 7 // as a contiguous region.
8 // 8 //
9 // This class is not threadsafe and requires external locking. 9 // This class is not threadsafe and requires external locking.
10 10
(...skipping 21 matching lines...) Expand all
32 // "consumed" buffers. 32 // "consumed" buffers.
33 void Consume(size_t bytes_to_be_consumed); 33 void Consume(size_t bytes_to_be_consumed);
34 34
35 // Tries to copy |bytes| bytes from our data to |dest|. Returns the number 35 // Tries to copy |bytes| bytes from our data to |dest|. Returns the number
36 // of bytes successfully copied. 36 // of bytes successfully copied.
37 size_t Copy(uint8* dest, size_t bytes); 37 size_t Copy(uint8* dest, size_t bytes);
38 38
39 // Enqueues |buffer_in| and adds a reference. 39 // Enqueues |buffer_in| and adds a reference.
40 void Enqueue(Buffer* buffer_in); 40 void Enqueue(Buffer* buffer_in);
41 41
42 // Returns the timestamp of the first buffer plus |data_offset_| in 42 // Returns the current timestamp, taking into account |data_offset_|.
43 // microseconds, calculated using the conversion |bytes_to_sec|. 43 base::TimeDelta GetTime();
44 base::TimeDelta GetTime(double bytes_to_sec);
45 44
46 // Returns true if the |queue_| is empty. 45 // Returns true if the |queue_| is empty.
47 bool IsEmpty(); 46 bool IsEmpty();
48 47
49 // Returns the number of bytes in the |queue_|. 48 // Returns the number of bytes in the |queue_|.
50 size_t SizeInBytes(); 49 size_t SizeInBytes();
51 50
52 private: 51 private:
53 // Queued audio data. 52 // Queued audio data.
54 std::deque< scoped_refptr<Buffer> > queue_; 53 std::deque< scoped_refptr<Buffer> > queue_;
55 54
56 // Remembers the amount of remaining audio data in the front buffer. 55 // Remembers the amount of remaining audio data in the front buffer.
57 size_t data_offset_; 56 size_t data_offset_;
58 57
59 // Keeps track of the |queue_| size in bytes. 58 // Keeps track of the |queue_| size in bytes.
60 size_t size_in_bytes_; 59 size_t size_in_bytes_;
61 60
61 // Keeps track of the most recent time we've seen in case the |queue_| is
62 // empty when our owner asks what time it is.
63 base::TimeDelta most_recent_time_;
64
62 DISALLOW_COPY_AND_ASSIGN(BufferQueue); 65 DISALLOW_COPY_AND_ASSIGN(BufferQueue);
63 }; 66 };
64 67
65 } // namespace media 68 } // namespace media
66 69
67 #endif // MEDIA_BASE_BUFFER_QUEUE_H_ 70 #endif // MEDIA_BASE_BUFFER_QUEUE_H_
OLDNEW
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl.cc ('k') | media/base/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698