| OLD | NEW |
| 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 // AudioRendererBase takes care of the tricky queuing work and provides simple | 5 // AudioRendererBase takes care of the tricky queuing work and provides simple |
| 6 // methods for subclasses to peek and poke at audio data. In addition to | 6 // methods for subclasses to peek and poke at audio data. In addition to |
| 7 // AudioRenderer interface methods this classes doesn't implement, subclasses | 7 // AudioRenderer interface methods this classes doesn't implement, subclasses |
| 8 // must also implement the following methods: | 8 // must also implement the following methods: |
| 9 // OnInitialized | 9 // OnInitialized |
| 10 // OnStop | 10 // OnStop |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 int* channels_out, int* sample_rate_out, | 86 int* channels_out, int* sample_rate_out, |
| 87 int* sample_bits_out); | 87 int* sample_bits_out); |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 // Helper method that schedules an asynchronous read from the decoder. | 90 // Helper method that schedules an asynchronous read from the decoder. |
| 91 // | 91 // |
| 92 // Safe to call from any thread. | 92 // Safe to call from any thread. |
| 93 void ScheduleRead(); | 93 void ScheduleRead(); |
| 94 | 94 |
| 95 // Audio decoder. | 95 // Audio decoder. |
| 96 AudioDecoder* decoder_; | 96 scoped_refptr<AudioDecoder> decoder_; |
| 97 | 97 |
| 98 // Maximum queue size, configuration parameter passed in during construction. | 98 // Maximum queue size, configuration parameter passed in during construction. |
| 99 size_t max_queue_size_; | 99 size_t max_queue_size_; |
| 100 | 100 |
| 101 // Queued audio data. | 101 // Queued audio data. |
| 102 typedef std::deque< scoped_refptr<Buffer> > BufferQueue; | 102 typedef std::deque< scoped_refptr<Buffer> > BufferQueue; |
| 103 BufferQueue queue_; | 103 BufferQueue queue_; |
| 104 Lock lock_; | 104 Lock lock_; |
| 105 | 105 |
| 106 // Remembers the amount of remaining audio data for the front buffer. | 106 // Remembers the amount of remaining audio data for the front buffer. |
| 107 size_t data_offset_; | 107 size_t data_offset_; |
| 108 | 108 |
| 109 // Whether or not we're initialized. | 109 // Whether or not we're initialized. |
| 110 bool initialized_; | 110 bool initialized_; |
| 111 | 111 |
| 112 // Whether or not we've stopped. | 112 // Whether or not we've stopped. |
| 113 bool stopped_; | 113 bool stopped_; |
| 114 | 114 |
| 115 // Audio time at end of last call to FillBuffer(). | 115 // Audio time at end of last call to FillBuffer(). |
| 116 // TODO(ralphl): Update this value after seeking. | 116 // TODO(ralphl): Update this value after seeking. |
| 117 base::TimeDelta last_fill_buffer_time_; | 117 base::TimeDelta last_fill_buffer_time_; |
| 118 | 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); | 119 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace media | 122 } // namespace media |
| 123 | 123 |
| 124 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ | 124 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ |
| OLD | NEW |