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_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 DCHECK_EQ(state_, NORMAL); | 146 DCHECK_EQ(state_, NORMAL); |
147 DCHECK(!read_cb_.IsNull()); | 147 DCHECK(!read_cb_.IsNull()); |
148 demuxer_stream_->Read(base::Bind(&FakeVideoDecoder::BufferReady, weak_this_)); | 148 demuxer_stream_->Read(base::Bind(&FakeVideoDecoder::BufferReady, weak_this_)); |
149 } | 149 } |
150 | 150 |
151 void FakeVideoDecoder::BufferReady(DemuxerStream::Status status, | 151 void FakeVideoDecoder::BufferReady(DemuxerStream::Status status, |
152 const scoped_refptr<DecoderBuffer>& buffer) { | 152 const scoped_refptr<DecoderBuffer>& buffer) { |
153 DCHECK(message_loop_->BelongsToCurrentThread()); | 153 DCHECK(message_loop_->BelongsToCurrentThread()); |
154 DCHECK_EQ(state_, NORMAL); | 154 DCHECK_EQ(state_, NORMAL); |
155 DCHECK(!read_cb_.IsNull()); | 155 DCHECK(!read_cb_.IsNull()); |
156 DCHECK_EQ(status != DemuxerStream::kOk, !buffer) << status; | 156 DCHECK_EQ(status != DemuxerStream::kOk, !buffer.get()) << status; |
157 | 157 |
158 if (!stop_cb_.IsNull()) { | 158 if (!stop_cb_.IsNull()) { |
159 read_cb_.RunOrHold(kOk, scoped_refptr<VideoFrame>()); | 159 read_cb_.RunOrHold(kOk, scoped_refptr<VideoFrame>()); |
160 if (!reset_cb_.IsNull()) { | 160 if (!reset_cb_.IsNull()) { |
161 DoReset(); | 161 DoReset(); |
162 } | 162 } |
163 DoStop(); | 163 DoStop(); |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 DCHECK(reset_cb_.IsNull()); | 230 DCHECK(reset_cb_.IsNull()); |
231 DCHECK(!stop_cb_.IsNull()); | 231 DCHECK(!stop_cb_.IsNull()); |
232 | 232 |
233 state_ = UNINITIALIZED; | 233 state_ = UNINITIALIZED; |
234 demuxer_stream_ = NULL; | 234 demuxer_stream_ = NULL; |
235 decoded_frames_.clear(); | 235 decoded_frames_.clear(); |
236 stop_cb_.RunOrHold(); | 236 stop_cb_.RunOrHold(); |
237 } | 237 } |
238 | 238 |
239 } // namespace media | 239 } // namespace media |
OLD | NEW |