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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return; | 180 return; |
181 } | 181 } |
182 | 182 |
183 if (status == DemuxerStream::kAborted) { | 183 if (status == DemuxerStream::kAborted) { |
184 read_cb_.RunOrHold(kOk, scoped_refptr<VideoFrame>()); | 184 read_cb_.RunOrHold(kOk, scoped_refptr<VideoFrame>()); |
185 return; | 185 return; |
186 } | 186 } |
187 | 187 |
188 DCHECK_EQ(status, DemuxerStream::kOk); | 188 DCHECK_EQ(status, DemuxerStream::kOk); |
189 | 189 |
190 if (buffer->IsEndOfStream() && decoded_frames_.empty()) { | 190 if (buffer->end_of_stream() && decoded_frames_.empty()) { |
191 read_cb_.RunOrHold(kOk, VideoFrame::CreateEmptyFrame()); | 191 read_cb_.RunOrHold(kOk, VideoFrame::CreateEmptyFrame()); |
192 return; | 192 return; |
193 } | 193 } |
194 | 194 |
195 if (!buffer->IsEndOfStream()) { | 195 if (!buffer->end_of_stream()) { |
196 // Make sure the decoder is always configured with the latest config. | 196 // Make sure the decoder is always configured with the latest config. |
197 DCHECK(current_config_.Matches(demuxer_stream_->video_decoder_config())) | 197 DCHECK(current_config_.Matches(demuxer_stream_->video_decoder_config())) |
198 << "Decoder's Current Config: " | 198 << "Decoder's Current Config: " |
199 << current_config_.AsHumanReadableString() | 199 << current_config_.AsHumanReadableString() |
200 << "DemuxerStream's Current Config: " | 200 << "DemuxerStream's Current Config: " |
201 << demuxer_stream_->video_decoder_config().AsHumanReadableString(); | 201 << demuxer_stream_->video_decoder_config().AsHumanReadableString(); |
202 | 202 |
203 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( | 203 scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateColorFrame( |
204 current_config_.coded_size(), 0, 0, 0, buffer->GetTimestamp()); | 204 current_config_.coded_size(), 0, 0, 0, buffer->timestamp()); |
205 decoded_frames_.push_back(video_frame); | 205 decoded_frames_.push_back(video_frame); |
206 | 206 |
207 if (decoded_frames_.size() <= static_cast<size_t>(decoding_delay_)) { | 207 if (decoded_frames_.size() <= static_cast<size_t>(decoding_delay_)) { |
208 ReadFromDemuxerStream(); | 208 ReadFromDemuxerStream(); |
209 return; | 209 return; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 scoped_refptr<VideoFrame> frame = decoded_frames_.front(); | 213 scoped_refptr<VideoFrame> frame = decoded_frames_.front(); |
214 decoded_frames_.pop_front(); | 214 decoded_frames_.pop_front(); |
(...skipping 15 matching lines...) Expand all 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 |