OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef REMOTING_TEST_TEST_VIDEO_RENDERER_H_ | 5 #ifndef REMOTING_TEST_TEST_VIDEO_RENDERER_H_ |
6 #define REMOTING_TEST_TEST_VIDEO_RENDERER_H_ | 6 #define REMOTING_TEST_TEST_VIDEO_RENDERER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
12 #include "remoting/client/video_renderer.h" | 12 #include "remoting/client/video_renderer.h" |
13 #include "remoting/protocol/session_config.h" | 13 #include "remoting/protocol/session_config.h" |
14 #include "remoting/protocol/video_stub.h" | 14 #include "remoting/protocol/video_stub.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class Thread; | 17 class Thread; |
18 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
19 } | 19 } |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 class DesktopFrame; | 22 class DesktopFrame; |
23 class DesktopRect; | 23 class DesktopRect; |
24 } | 24 } |
25 | 25 |
26 namespace remoting { | 26 namespace remoting { |
27 namespace test { | 27 namespace test { |
28 | 28 |
| 29 struct RGBValue; |
| 30 |
29 // Processes video packets as they are received from the remote host. Must be | 31 // Processes video packets as they are received from the remote host. Must be |
30 // used from a thread running a message loop and this class will use that | 32 // used from a thread running a message loop and this class will use that |
31 // message loop to execute the done callbacks passed by the caller of | 33 // message loop to execute the done callbacks passed by the caller of |
32 // ProcessVideoPacket. | 34 // ProcessVideoPacket. |
33 class TestVideoRenderer : public VideoRenderer, public protocol::VideoStub { | 35 class TestVideoRenderer : public VideoRenderer, public protocol::VideoStub { |
34 public: | 36 public: |
35 TestVideoRenderer(); | 37 TestVideoRenderer(); |
36 ~TestVideoRenderer() override; | 38 ~TestVideoRenderer() override; |
37 | 39 |
38 // VideoRenderer interface. | 40 // VideoRenderer interface. |
(...skipping 13 matching lines...) Expand all Loading... |
52 | 54 |
53 // Gets a weak pointer for this object. | 55 // Gets a weak pointer for this object. |
54 base::WeakPtr<TestVideoRenderer> GetWeakPtr() { | 56 base::WeakPtr<TestVideoRenderer> GetWeakPtr() { |
55 return weak_factory_.GetWeakPtr(); | 57 return weak_factory_.GetWeakPtr(); |
56 } | 58 } |
57 | 59 |
58 // Set expected rect and average color for comparison and the callback will be | 60 // Set expected rect and average color for comparison and the callback will be |
59 // called when the pattern is matched. | 61 // called when the pattern is matched. |
60 void ExpectAverageColorInRect( | 62 void ExpectAverageColorInRect( |
61 const webrtc::DesktopRect& expected_rect, | 63 const webrtc::DesktopRect& expected_rect, |
62 uint32_t expected_average_color, | 64 const RGBValue& expected_average_color, |
63 const base::Closure& image_pattern_matched_callback); | 65 const base::Closure& image_pattern_matched_callback); |
64 | 66 |
65 private: | 67 private: |
66 // The actual implementation resides in Core class. | 68 // The actual implementation resides in Core class. |
67 class Core; | 69 class Core; |
68 scoped_ptr<Core> core_; | 70 scoped_ptr<Core> core_; |
69 | 71 |
70 // Used to ensure TestVideoRenderer methods are called on the same thread. | 72 // Used to ensure TestVideoRenderer methods are called on the same thread. |
71 base::ThreadChecker thread_checker_; | 73 base::ThreadChecker thread_checker_; |
72 | 74 |
73 // Used to decode and process video packets. | 75 // Used to decode and process video packets. |
74 scoped_ptr<base::Thread> video_decode_thread_; | 76 scoped_ptr<base::Thread> video_decode_thread_; |
75 | 77 |
76 // Used to post tasks to video decode thread. | 78 // Used to post tasks to video decode thread. |
77 scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_; | 79 scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_; |
78 | 80 |
79 // Used to weakly bind |this| to methods. | 81 // Used to weakly bind |this| to methods. |
80 // NOTE: Weak pointers must be invalidated before all other member variables. | 82 // NOTE: Weak pointers must be invalidated before all other member variables. |
81 base::WeakPtrFactory<TestVideoRenderer> weak_factory_; | 83 base::WeakPtrFactory<TestVideoRenderer> weak_factory_; |
82 | 84 |
83 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); | 85 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); |
84 }; | 86 }; |
85 | 87 |
86 } // namespace test | 88 } // namespace test |
87 } // namespace remoting | 89 } // namespace remoting |
88 | 90 |
89 #endif // REMOTING_TEST_TEST_VIDEO_RENDERER_H_ | 91 #endif // REMOTING_TEST_TEST_VIDEO_RENDERER_H_ |
OLD | NEW |