OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 // | 4 // |
5 // Simple test class used by unit tests. Tests create the filter on the test's | 5 // Simple test class used by unit tests. Tests create the filter on the test's |
6 // thread and then use InstanceFilterFactory to force the test's instance to | 6 // thread and then use InstanceFilterFactory to force the test's instance to |
7 // be returned to the pipeline. | 7 // be returned to the pipeline. |
8 | 8 |
9 #ifndef MEDIA_FILTERS_TEST_VIDEO_RENDERER_H_ | 9 #ifndef MEDIA_FILTERS_TEST_VIDEO_RENDERER_H_ |
10 #define MEDIA_FILTERS_TEST_VIDEO_RENDERER_H_ | 10 #define MEDIA_FILTERS_TEST_VIDEO_RENDERER_H_ |
(...skipping 13 matching lines...) Expand all Loading... |
24 unique_frames_(0) { | 24 unique_frames_(0) { |
25 } | 25 } |
26 | 26 |
27 virtual bool OnInitialize(size_t width, size_t height) { return true; } | 27 virtual bool OnInitialize(size_t width, size_t height) { return true; } |
28 | 28 |
29 virtual void OnPaintNeeded() { | 29 virtual void OnPaintNeeded() { |
30 ++paint_called_; | 30 ++paint_called_; |
31 scoped_refptr<VideoFrame> frame; | 31 scoped_refptr<VideoFrame> frame; |
32 GetCurrentFrame(&frame); | 32 GetCurrentFrame(&frame); |
33 if (frame.get()) { | 33 if (frame.get()) { |
| 34 VideoSurface video_surface; |
| 35 EXPECT_TRUE(frame->Lock(&video_surface)); |
| 36 frame->Unlock(); |
34 if (frame != last_frame_) { | 37 if (frame != last_frame_) { |
35 ++unique_frames_; | 38 ++unique_frames_; |
36 last_frame_ = frame; | 39 last_frame_ = frame; |
37 last_timestamp_ = frame->GetTimestamp(); | 40 last_timestamp_ = frame->GetTimestamp(); |
38 } | 41 } |
39 } | 42 } |
40 } | 43 } |
41 | 44 |
42 size_t unique_frames() { return unique_frames_; } | 45 size_t unique_frames() { return unique_frames_; } |
43 size_t paint_called() { return paint_called_; } | 46 size_t paint_called() { return paint_called_; } |
(...skipping 11 matching lines...) Expand all Loading... |
55 size_t paint_called_; | 58 size_t paint_called_; |
56 size_t unique_frames_; | 59 size_t unique_frames_; |
57 base::TimeDelta last_timestamp_; | 60 base::TimeDelta last_timestamp_; |
58 | 61 |
59 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); | 62 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); |
60 }; | 63 }; |
61 | 64 |
62 } // namespace | 65 } // namespace |
63 | 66 |
64 #endif // MEDIA_FILTERS_TEST_VIDEO_RENDERER_H_ | 67 #endif // MEDIA_FILTERS_TEST_VIDEO_RENDERER_H_ |
OLD | NEW |