Index: remoting/test/test_video_renderer.h |
diff --git a/remoting/test/test_video_renderer.h b/remoting/test/test_video_renderer.h |
index fcf122abcd9aa29bddcf086d522aae0cd08eb5bc..822e6866223f1297089f5cfaa05202602fb33ec2 100644 |
--- a/remoting/test/test_video_renderer.h |
+++ b/remoting/test/test_video_renderer.h |
@@ -5,15 +5,30 @@ |
#ifndef REMOTING_TEST_TEST_VIDEO_RENDERER_H_ |
#define REMOTING_TEST_TEST_VIDEO_RENDERER_H_ |
-#include "base/callback.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/threading/thread_checker.h" |
+#include "media/base/video_frame.h" |
#include "remoting/client/video_renderer.h" |
+#include "remoting/protocol/session_config.h" |
#include "remoting/protocol/video_stub.h" |
+namespace base { |
+class Thread; |
+class SingleThreadTaskRunner; |
+} |
+ |
+namespace webrtc { |
+class DesktopFrame; |
+} |
+ |
namespace remoting { |
namespace test { |
-// Processes video packets as they are received from the remote host. |
+// Processes video packets as they are received from the remote host. Must be |
+// used from a thread running a message loop and this class will use that |
+// message loop to execute the done callbacks passed by the caller of |
+// ProcessVideoPacket. |
class TestVideoRenderer : public VideoRenderer, public protocol::VideoStub { |
public: |
TestVideoRenderer(); |
@@ -24,13 +39,33 @@ class TestVideoRenderer : public VideoRenderer, public protocol::VideoStub { |
ChromotingStats* GetStats() override; |
protocol::VideoStub* GetVideoStub() override; |
- private: |
// protocol::VideoStub interface. |
void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, |
const base::Closure& done) override; |
- // Track the number of populated video frames which have been received. |
- int video_frames_processed_; |
+ // Initialize a decoder to decode video packets. |
+ void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec); |
+ |
+ // Returns a copy of the current buffer. |
+ scoped_ptr<webrtc::DesktopFrame> GetBufferForTest() const; |
+ |
+ private: |
+ // The actual implementation resides in Core class. |
+ class Core; |
+ scoped_ptr<Core> core_; |
+ |
+ // Used to ensure TestVideoRenderer methods are called on the same thread. |
+ base::ThreadChecker thread_checker_; |
+ |
+ // Used to decode and process video packets. |
+ scoped_ptr<base::Thread> video_decode_thread_; |
+ |
+ // Used to post tasks to video decode thread. |
+ scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_; |
+ |
+ // Used to weakly bind |this| to methods. |
+ // NOTE: Weak pointers must be invalidated before all other member variables. |
+ base::WeakPtrFactory<TestVideoRenderer> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer); |
}; |