| 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" |
| 11 #include "media/base/bind_to_current_loop.h" | 11 #include "media/base/bind_to_current_loop.h" |
| 12 #include "media/base/test_helpers.h" | 12 #include "media/base/test_helpers.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 FakeVideoDecoder::FakeVideoDecoder(int decoding_delay) | 16 FakeVideoDecoder::FakeVideoDecoder(int decoding_delay) |
| 17 : task_runner_(base::MessageLoopProxy::current()), | 17 : task_runner_(base::MessageLoopProxy::current()), |
| 18 weak_factory_(this), | |
| 19 decoding_delay_(decoding_delay), | 18 decoding_delay_(decoding_delay), |
| 20 state_(UNINITIALIZED), | 19 state_(UNINITIALIZED), |
| 21 total_bytes_decoded_(0) { | 20 total_bytes_decoded_(0), |
| 21 weak_factory_(this) { |
| 22 DCHECK_GE(decoding_delay, 0); | 22 DCHECK_GE(decoding_delay, 0); |
| 23 } | 23 } |
| 24 | 24 |
| 25 FakeVideoDecoder::~FakeVideoDecoder() { | 25 FakeVideoDecoder::~FakeVideoDecoder() { |
| 26 DCHECK_EQ(state_, UNINITIALIZED); | 26 DCHECK_EQ(state_, UNINITIALIZED); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void FakeVideoDecoder::Initialize(const VideoDecoderConfig& config, | 29 void FakeVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| 30 const PipelineStatusCB& status_cb) { | 30 const PipelineStatusCB& status_cb) { |
| 31 DCHECK(task_runner_->BelongsToCurrentThread()); | 31 DCHECK(task_runner_->BelongsToCurrentThread()); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 int buffer_size, | 185 int buffer_size, |
| 186 const DecodeCB& decode_cb, | 186 const DecodeCB& decode_cb, |
| 187 Status status, | 187 Status status, |
| 188 const scoped_refptr<VideoFrame>& video_frame) { | 188 const scoped_refptr<VideoFrame>& video_frame) { |
| 189 if (status == kOk || status == kNotEnoughData) | 189 if (status == kOk || status == kNotEnoughData) |
| 190 total_bytes_decoded_ += buffer_size; | 190 total_bytes_decoded_ += buffer_size; |
| 191 decode_cb.Run(status, video_frame); | 191 decode_cb.Run(status, video_frame); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace media | 194 } // namespace media |
| OLD | NEW |