| OLD | NEW |
| 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 // 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 friend class AudioRendererBaseTest; | 108 friend class AudioRendererBaseTest; |
| 109 | 109 |
| 110 // Helper method that schedules an asynchronous read from the decoder and | 110 // Helper method that schedules an asynchronous read from the decoder and |
| 111 // increments |pending_reads_|. | 111 // increments |pending_reads_|. |
| 112 // | 112 // |
| 113 // Safe to call from any thread. | 113 // Safe to call from any thread. |
| 114 void ScheduleRead_Locked(); | 114 void ScheduleRead_Locked(); |
| 115 | 115 |
| 116 // Returns true if the data in the buffer is all before |
| 117 // |seek_timestamp_|. This can only return true while |
| 118 // in the kSeeking state. |
| 119 bool IsBeforeSeekTime(const scoped_refptr<Buffer>& buffer); |
| 120 |
| 116 // Audio decoder. | 121 // Audio decoder. |
| 117 scoped_refptr<AudioDecoder> decoder_; | 122 scoped_refptr<AudioDecoder> decoder_; |
| 118 | 123 |
| 119 // Algorithm for scaling audio. | 124 // Algorithm for scaling audio. |
| 120 scoped_ptr<AudioRendererAlgorithmBase> algorithm_; | 125 scoped_ptr<AudioRendererAlgorithmBase> algorithm_; |
| 121 | 126 |
| 122 base::Lock lock_; | 127 base::Lock lock_; |
| 123 | 128 |
| 124 // Simple state tracking variable. | 129 // Simple state tracking variable. |
| 125 enum State { | 130 enum State { |
| 126 kUninitialized, | 131 kUninitialized, |
| 127 kPaused, | 132 kPaused, |
| 128 kSeeking, | 133 kSeeking, |
| 129 kPlaying, | 134 kPlaying, |
| 130 kStopped, | 135 kStopped, |
| 131 kError, | |
| 132 kUnderflow, | 136 kUnderflow, |
| 133 kRebuffering, | 137 kRebuffering, |
| 134 }; | 138 }; |
| 135 State state_; | 139 State state_; |
| 136 | 140 |
| 137 // Keep track of our outstanding read to |decoder_|. | 141 // Keep track of our outstanding read to |decoder_|. |
| 138 bool pending_read_; | 142 bool pending_read_; |
| 139 | 143 |
| 140 // Keeps track of whether we received and rendered the end of stream buffer. | 144 // Keeps track of whether we received and rendered the end of stream buffer. |
| 141 bool recieved_end_of_stream_; | 145 bool recieved_end_of_stream_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 base::TimeDelta seek_timestamp_; | 158 base::TimeDelta seek_timestamp_; |
| 155 | 159 |
| 156 AudioDecoder::ReadCB read_cb_; | 160 AudioDecoder::ReadCB read_cb_; |
| 157 | 161 |
| 158 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); | 162 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); |
| 159 }; | 163 }; |
| 160 | 164 |
| 161 } // namespace media | 165 } // namespace media |
| 162 | 166 |
| 163 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ | 167 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ |
| OLD | NEW |