OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/test/fake_video_frame_provider.h" | 5 #include "cc/test/fake_video_frame_provider.h" |
6 | 6 |
7 namespace cc { | 7 namespace cc { |
8 | 8 |
9 FakeVideoFrameProvider::FakeVideoFrameProvider() | 9 FakeVideoFrameProvider::FakeVideoFrameProvider() |
10 : frame_(NULL), client_(NULL), put_current_frame_count_(0) { | 10 : frame_(NULL), client_(NULL), put_current_frame_count_(0) { |
11 } | 11 } |
12 | 12 |
13 FakeVideoFrameProvider::~FakeVideoFrameProvider() { | 13 FakeVideoFrameProvider::~FakeVideoFrameProvider() { |
14 if (client_) | 14 if (client_) |
15 client_->StopUsingProvider(); | 15 client_->StopUsingProvider(); |
16 } | 16 } |
17 | 17 |
18 bool FakeVideoFrameProvider::UpdateCurrentFrame(base::TimeTicks deadline_min, | 18 bool FakeVideoFrameProvider::UpdateCurrentFrame(base::TimeTicks deadline_min, |
19 base::TimeTicks deadline_max) { | 19 base::TimeTicks deadline_max) { |
20 return HasCurrentFrame(); | 20 return HasCurrentFrame(); |
21 } | 21 } |
22 | 22 |
23 void FakeVideoFrameProvider::SetVideoFrameProviderClient(Client* client) { | 23 void FakeVideoFrameProvider::SetVideoFrameProviderClient(Client* client) { |
24 client_ = client; | 24 client_ = client; |
25 } | 25 } |
26 | 26 |
27 bool FakeVideoFrameProvider::HasCurrentFrame() { | 27 bool FakeVideoFrameProvider::HasCurrentFrame() { |
28 return frame_; | 28 return static_cast<bool>(frame_); |
29 } | 29 } |
30 | 30 |
31 scoped_refptr<media::VideoFrame> FakeVideoFrameProvider::GetCurrentFrame() { | 31 scoped_refptr<media::VideoFrame> FakeVideoFrameProvider::GetCurrentFrame() { |
32 return frame_; | 32 return frame_; |
33 } | 33 } |
34 | 34 |
35 void FakeVideoFrameProvider::PutCurrentFrame() { | 35 void FakeVideoFrameProvider::PutCurrentFrame() { |
36 ++put_current_frame_count_; | 36 ++put_current_frame_count_; |
37 } | 37 } |
38 | 38 |
39 } // namespace cc | 39 } // namespace cc |
OLD | NEW |