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 <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
12 #include "remoting/protocol/session_config.h" | 13 #include "remoting/protocol/session_config.h" |
13 #include "remoting/protocol/video_renderer.h" | 14 #include "remoting/protocol/video_renderer.h" |
14 #include "remoting/protocol/video_stub.h" | 15 #include "remoting/protocol/video_stub.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class Thread; | 18 class Thread; |
18 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
19 } | 20 } |
(...skipping 17 matching lines...) Expand all Loading... |
37 public: | 38 public: |
38 TestVideoRenderer(); | 39 TestVideoRenderer(); |
39 ~TestVideoRenderer() override; | 40 ~TestVideoRenderer() override; |
40 | 41 |
41 // VideoRenderer interface. | 42 // VideoRenderer interface. |
42 void OnSessionConfig(const protocol::SessionConfig& config) override; | 43 void OnSessionConfig(const protocol::SessionConfig& config) override; |
43 protocol::VideoStub* GetVideoStub() override; | 44 protocol::VideoStub* GetVideoStub() override; |
44 protocol::FrameConsumer* GetFrameConsumer() override; | 45 protocol::FrameConsumer* GetFrameConsumer() override; |
45 | 46 |
46 // protocol::VideoStub interface. | 47 // protocol::VideoStub interface. |
47 void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, | 48 void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet, |
48 const base::Closure& done) override; | 49 const base::Closure& done) override; |
49 | 50 |
50 // Initialize a decoder to decode video packets. | 51 // Initialize a decoder to decode video packets. |
51 void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec); | 52 void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec); |
52 | 53 |
53 // Returns a copy of the current frame. | 54 // Returns a copy of the current frame. |
54 scoped_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const; | 55 std::unique_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const; |
55 | 56 |
56 // Gets a weak pointer for this object. | 57 // Gets a weak pointer for this object. |
57 base::WeakPtr<TestVideoRenderer> GetWeakPtr() { | 58 base::WeakPtr<TestVideoRenderer> GetWeakPtr() { |
58 return weak_factory_.GetWeakPtr(); | 59 return weak_factory_.GetWeakPtr(); |
59 } | 60 } |
60 | 61 |
61 // Set expected rect and average color for comparison and the callback will be | 62 // Set expected rect and average color for comparison and the callback will be |
62 // called when the pattern is matched. | 63 // called when the pattern is matched. |
63 void ExpectAverageColorInRect( | 64 void ExpectAverageColorInRect( |
64 const webrtc::DesktopRect& expected_rect, | 65 const webrtc::DesktopRect& expected_rect, |
65 const RGBValue& expected_average_color, | 66 const RGBValue& expected_average_color, |
66 const base::Closure& image_pattern_matched_callback); | 67 const base::Closure& image_pattern_matched_callback); |
67 | 68 |
68 // Turn on/off saving video frames to disk. | 69 // Turn on/off saving video frames to disk. |
69 void SaveFrameDataToDisk(bool save_frame_data_to_disk); | 70 void SaveFrameDataToDisk(bool save_frame_data_to_disk); |
70 | 71 |
71 private: | 72 private: |
72 // The actual implementation resides in Core class. | 73 // The actual implementation resides in Core class. |
73 class Core; | 74 class Core; |
74 scoped_ptr<Core> core_; | 75 std::unique_ptr<Core> core_; |
75 | 76 |
76 // Used to ensure TestVideoRenderer methods are called on the same thread. | 77 // Used to ensure TestVideoRenderer methods are called on the same thread. |
77 base::ThreadChecker thread_checker_; | 78 base::ThreadChecker thread_checker_; |
78 | 79 |
79 // Used to decode and process video packets. | 80 // Used to decode and process video packets. |
80 scoped_ptr<base::Thread> video_decode_thread_; | 81 std::unique_ptr<base::Thread> video_decode_thread_; |
81 | 82 |
82 // Used to post tasks to video decode thread. | 83 // Used to post tasks to video decode thread. |
83 scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_; | 84 scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_; |
84 | 85 |
85 // Used to weakly bind |this| to methods. | 86 // Used to weakly bind |this| to methods. |
86 // NOTE: Weak pointers must be invalidated before all other member variables. | 87 // NOTE: Weak pointers must be invalidated before all other member variables. |
87 base::WeakPtrFactory<TestVideoRenderer> weak_factory_; | 88 base::WeakPtrFactory<TestVideoRenderer> weak_factory_; |
88 | 89 |
89 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); | 90 DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); |
90 }; | 91 }; |
91 | 92 |
92 } // namespace test | 93 } // namespace test |
93 } // namespace remoting | 94 } // namespace remoting |
94 | 95 |
95 #endif // REMOTING_TEST_TEST_VIDEO_RENDERER_H_ | 96 #endif // REMOTING_TEST_TEST_VIDEO_RENDERER_H_ |
OLD | NEW |