OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_CLIENT_JNI_JNI_VIDEO_RENDERER_H_ | |
6 #define REMOTING_CLIENT_JNI_JNI_VIDEO_RENDERER_H_ | |
7 | |
8 #include <list> | |
9 #include <memory> | |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "remoting/client/software_video_renderer.h" | |
15 #include "remoting/protocol/frame_consumer.h" | |
16 #include "remoting/protocol/video_renderer.h" | |
17 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
18 | |
19 namespace remoting { | |
20 | |
21 class ClientContext; | |
22 class ChromotingJniRuntime; | |
23 class JniClient; | |
24 class JniDisplayHandler; | |
25 | |
26 // FrameConsumer and VideoRenderer implementation that draws onto a JNI direct | |
27 // byte buffer. | |
28 class JniVideoRenderer : public protocol::FrameConsumer, | |
29 public protocol::VideoRenderer { | |
30 public: | |
31 JniVideoRenderer( | |
32 ChromotingJniRuntime* jni_runtime, | |
33 base::WeakPtr<JniDisplayHandler> display); | |
34 | |
35 ~JniVideoRenderer() override; | |
36 | |
37 // FrameConsumer implementation. | |
38 std::unique_ptr<webrtc::DesktopFrame> AllocateFrame( | |
39 const webrtc::DesktopSize& size) override; | |
40 void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame, | |
41 const base::Closure& done) override; | |
42 PixelFormat GetPixelFormat() override; | |
43 | |
44 // VideoRenderer implementation. | |
45 bool Initialize(const ClientContext& client_context, | |
46 protocol::FrameStatsConsumer* stats_consumer) override; | |
47 void OnSessionConfig(const protocol::SessionConfig& config) override; | |
48 protocol::VideoStub* GetVideoStub() override; | |
49 protocol::FrameConsumer* GetFrameConsumer() override; | |
50 protocol::FrameStatsConsumer* GetFrameStatsConsumer() override; | |
51 | |
52 private: | |
53 class Renderer; | |
54 | |
55 void OnFrameRendered(const base::Closure& done); | |
56 | |
57 // Used to obtain task runner references and make calls to Java methods. | |
58 ChromotingJniRuntime* jni_runtime_; | |
59 | |
60 SoftwareVideoRenderer software_video_renderer_; | |
61 | |
62 // Renderer object used to render the frames on the display thread. | |
63 std::unique_ptr<Renderer> renderer_; | |
64 | |
65 base::WeakPtrFactory<JniVideoRenderer> weak_factory_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(JniVideoRenderer); | |
68 }; | |
69 | |
70 } // namespace remoting | |
71 | |
72 #endif // REMOTING_CLIENT_JNI_JNI_VIDEO_RENDERER_H_ | |
OLD | NEW |