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/filters/fake_video_decoder.h" | 5 #include "media/filters/fake_video_decoder.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/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 output_cb_.Run(decoded_frames_.front()); | 218 output_cb_.Run(decoded_frames_.front()); |
219 decoded_frames_.pop_front(); | 219 decoded_frames_.pop_front(); |
220 } else if (state_ == STATE_END_OF_STREAM) { | 220 } else if (state_ == STATE_END_OF_STREAM) { |
221 // Drain the queue if this was the last request in the stream, otherwise | 221 // Drain the queue if this was the last request in the stream, otherwise |
222 // just pop the last frame from the queue. | 222 // just pop the last frame from the queue. |
223 if (held_decode_callbacks_.empty()) { | 223 if (held_decode_callbacks_.empty()) { |
224 while (!decoded_frames_.empty()) { | 224 while (!decoded_frames_.empty()) { |
225 output_cb_.Run(decoded_frames_.front()); | 225 output_cb_.Run(decoded_frames_.front()); |
226 decoded_frames_.pop_front(); | 226 decoded_frames_.pop_front(); |
227 } | 227 } |
228 output_cb_.Run(VideoFrame::CreateEOSFrame()); | |
229 } else if (!decoded_frames_.empty()) { | 228 } else if (!decoded_frames_.empty()) { |
230 output_cb_.Run(decoded_frames_.front()); | 229 output_cb_.Run(decoded_frames_.front()); |
231 decoded_frames_.pop_front(); | 230 decoded_frames_.pop_front(); |
232 } | 231 } |
233 } | 232 } |
234 | 233 |
235 decode_cb.Run(kOk); | 234 decode_cb.Run(kOk); |
236 } | 235 } |
237 | 236 |
238 void FakeVideoDecoder::DoReset() { | 237 void FakeVideoDecoder::DoReset() { |
239 DCHECK(thread_checker_.CalledOnValidThread()); | 238 DCHECK(thread_checker_.CalledOnValidThread()); |
240 DCHECK(held_decode_callbacks_.empty()); | 239 DCHECK(held_decode_callbacks_.empty()); |
241 DCHECK(!reset_cb_.IsNull()); | 240 DCHECK(!reset_cb_.IsNull()); |
242 | 241 |
243 reset_cb_.RunOrHold(); | 242 reset_cb_.RunOrHold(); |
244 } | 243 } |
245 | 244 |
246 } // namespace media | 245 } // namespace media |
OLD | NEW |