OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "media/base/text_renderer.h" | 5 #include "media/base/text_renderer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 void TextRenderer::BufferReady( | 132 void TextRenderer::BufferReady( |
133 DemuxerStream* stream, | 133 DemuxerStream* stream, |
134 DemuxerStream::Status status, | 134 DemuxerStream::Status status, |
135 const scoped_refptr<DecoderBuffer>& input) { | 135 const scoped_refptr<DecoderBuffer>& input) { |
136 DCHECK(task_runner_->BelongsToCurrentThread()); | 136 DCHECK(task_runner_->BelongsToCurrentThread()); |
137 DCHECK_NE(status, DemuxerStream::kConfigChanged); | 137 DCHECK_NE(status, DemuxerStream::kConfigChanged); |
138 | 138 |
139 if (status == DemuxerStream::kAborted) { | 139 if (status == DemuxerStream::kAborted) { |
140 DCHECK(!input); | 140 DCHECK(!input.get()); |
141 DCHECK_GT(pending_read_count_, 0); | 141 DCHECK_GT(pending_read_count_, 0); |
142 DCHECK(pending_eos_set_.find(stream) != pending_eos_set_.end()); | 142 DCHECK(pending_eos_set_.find(stream) != pending_eos_set_.end()); |
143 | 143 |
144 TextTrackStateMap::iterator itr = text_track_state_map_.find(stream); | 144 TextTrackStateMap::iterator itr = text_track_state_map_.find(stream); |
145 DCHECK(itr != text_track_state_map_.end()); | 145 DCHECK(itr != text_track_state_map_.end()); |
146 | 146 |
147 TextTrackState* state = itr->second; | 147 TextTrackState* state = itr->second; |
148 DCHECK_EQ(state->read_state, TextTrackState::kReadPending); | 148 DCHECK_EQ(state->read_state, TextTrackState::kReadPending); |
149 | 149 |
150 --pending_read_count_; | 150 --pending_read_count_; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 TextTrackState* state = itr->second; | 218 TextTrackState* state = itr->second; |
219 DCHECK_EQ(state->read_state, TextTrackState::kReadPending); | 219 DCHECK_EQ(state->read_state, TextTrackState::kReadPending); |
220 DCHECK(state->text_track); | 220 DCHECK(state->text_track); |
221 | 221 |
222 --pending_read_count_; | 222 --pending_read_count_; |
223 state->read_state = TextTrackState::kReadIdle; | 223 state->read_state = TextTrackState::kReadIdle; |
224 | 224 |
225 switch (state_) { | 225 switch (state_) { |
226 case kPlaying: { | 226 case kPlaying: { |
227 if (text_cue) | 227 if (text_cue.get()) |
228 break; | 228 break; |
229 | 229 |
230 const size_t count = pending_eos_set_.erase(text_stream); | 230 const size_t count = pending_eos_set_.erase(text_stream); |
231 DCHECK_EQ(count, 1U); | 231 DCHECK_EQ(count, 1U); |
232 | 232 |
233 if (pending_eos_set_.empty()) { | 233 if (pending_eos_set_.empty()) { |
234 DCHECK_EQ(pending_read_count_, 0); | 234 DCHECK_EQ(pending_read_count_, 0); |
235 state_ = kEnded; | 235 state_ = kEnded; |
236 task_runner_->PostTask(FROM_HERE, ended_cb_); | 236 task_runner_->PostTask(FROM_HERE, ended_cb_); |
237 return; | 237 return; |
238 } | 238 } |
239 | 239 |
240 DCHECK_GT(pending_read_count_, 0); | 240 DCHECK_GT(pending_read_count_, 0); |
241 return; | 241 return; |
242 } | 242 } |
243 case kPausePending: { | 243 case kPausePending: { |
244 if (text_cue) | 244 if (text_cue.get()) |
245 break; | 245 break; |
246 | 246 |
247 const size_t count = pending_eos_set_.erase(text_stream); | 247 const size_t count = pending_eos_set_.erase(text_stream); |
248 DCHECK_EQ(count, 1U); | 248 DCHECK_EQ(count, 1U); |
249 | 249 |
250 if (pending_read_count_ > 0) { | 250 if (pending_read_count_ > 0) { |
251 DCHECK(!pending_eos_set_.empty()); | 251 DCHECK(!pending_eos_set_.empty()); |
252 return; | 252 return; |
253 } | 253 } |
254 | 254 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 TextRenderer::TextTrackState::TextTrackState(scoped_ptr<TextTrack> tt) | 318 TextRenderer::TextTrackState::TextTrackState(scoped_ptr<TextTrack> tt) |
319 : read_state(kReadIdle), | 319 : read_state(kReadIdle), |
320 text_track(tt.Pass()) { | 320 text_track(tt.Pass()) { |
321 } | 321 } |
322 | 322 |
323 TextRenderer::TextTrackState::~TextTrackState() { | 323 TextRenderer::TextTrackState::~TextTrackState() { |
324 } | 324 } |
325 | 325 |
326 } // namespace media | 326 } // namespace media |
OLD | NEW |