| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "media/base/bind_to_current_loop.h" | 8 #include "media/base/bind_to_current_loop.h" |
| 9 #include "media/base/test_helpers.h" | 9 #include "media/base/test_helpers.h" |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 BindToCurrentLoop(decode_cb)); | 93 BindToCurrentLoop(decode_cb)); |
| 94 | 94 |
| 95 if (state_ == STATE_ERROR) { | 95 if (state_ == STATE_ERROR) { |
| 96 wrapped_decode_cb.Run(DecodeStatus::DECODE_ERROR); | 96 wrapped_decode_cb.Run(DecodeStatus::DECODE_ERROR); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (buffer->end_of_stream()) { | 100 if (buffer->end_of_stream()) { |
| 101 state_ = STATE_END_OF_STREAM; | 101 state_ = STATE_END_OF_STREAM; |
| 102 } else { | 102 } else { |
| 103 DCHECK(VerifyFakeVideoBufferForTest(buffer, current_config_)); | |
| 104 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( | 103 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( |
| 105 current_config_.coded_size(), 0, 0, 0, buffer->timestamp()); | 104 current_config_.coded_size(), 0, 0, 0, buffer->timestamp()); |
| 106 decoded_frames_.push_back(video_frame); | 105 decoded_frames_.push_back(video_frame); |
| 107 } | 106 } |
| 108 | 107 |
| 109 RunOrHoldDecode(wrapped_decode_cb); | 108 RunOrHoldDecode(wrapped_decode_cb); |
| 110 } | 109 } |
| 111 | 110 |
| 112 void FakeVideoDecoder::Reset(const base::Closure& closure) { | 111 void FakeVideoDecoder::Reset(const base::Closure& closure) { |
| 113 DCHECK(thread_checker_.CalledOnValidThread()); | 112 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 251 |
| 253 void FakeVideoDecoder::DoReset() { | 252 void FakeVideoDecoder::DoReset() { |
| 254 DCHECK(thread_checker_.CalledOnValidThread()); | 253 DCHECK(thread_checker_.CalledOnValidThread()); |
| 255 DCHECK(held_decode_callbacks_.empty()); | 254 DCHECK(held_decode_callbacks_.empty()); |
| 256 DCHECK(!reset_cb_.IsNull()); | 255 DCHECK(!reset_cb_.IsNull()); |
| 257 | 256 |
| 258 reset_cb_.RunOrHold(); | 257 reset_cb_.RunOrHold(); |
| 259 } | 258 } |
| 260 | 259 |
| 261 } // namespace media | 260 } // namespace media |
| OLD | NEW |