| 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_IOS_BRIDGE_FRAME_CONSUMER_BRIDGE_H_ | |
| 6 #define REMOTING_CLIENT_IOS_BRIDGE_FRAME_CONSUMER_BRIDGE_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 #include <memory> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "base/memory/scoped_vector.h" | |
| 14 #include "base/memory/weak_ptr.h" | |
| 15 #include "remoting/client/ios/bridge/client_instance.h" | |
| 16 #include "remoting/protocol/frame_consumer.h" | |
| 17 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | |
| 18 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
| 19 | |
| 20 namespace remoting { | |
| 21 | |
| 22 class ClientInstance; | |
| 23 | |
| 24 // TODO(nicholss): It should be possible to use remoting/client/ | |
| 25 // dual_buffer_frame_consumer.h instead of this class. | |
| 26 class FrameConsumerBridge : public protocol::FrameConsumer { | |
| 27 public: | |
| 28 typedef base::Callback<void(webrtc::DesktopFrame* buffer)> OnFrameCallback; | |
| 29 | |
| 30 // A callback is provided to return frame updates asynchronously. | |
| 31 explicit FrameConsumerBridge(ClientInstance* client_instance, | |
| 32 const OnFrameCallback callback); | |
| 33 | |
| 34 ~FrameConsumerBridge() override; | |
| 35 | |
| 36 std::unique_ptr<webrtc::DesktopFrame> AllocateFrame( | |
| 37 const webrtc::DesktopSize& size) override; | |
| 38 | |
| 39 void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame, | |
| 40 const base::Closure& done) override; | |
| 41 | |
| 42 PixelFormat GetPixelFormat() override; | |
| 43 | |
| 44 private: | |
| 45 void RenderFrame(std::unique_ptr<webrtc::DesktopFrame> frame); | |
| 46 | |
| 47 void OnFrameRendered(const base::Closure& done); | |
| 48 | |
| 49 OnFrameCallback callback_; | |
| 50 | |
| 51 ClientInstance* runtime_; | |
| 52 | |
| 53 webrtc::DesktopSize view_size_; | |
| 54 | |
| 55 base::WeakPtrFactory<FrameConsumerBridge> weak_factory_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(FrameConsumerBridge); | |
| 58 }; | |
| 59 | |
| 60 } // namespace remoting | |
| 61 | |
| 62 #endif // REMOTING_CLIENT_IOS_BRIDGE_FRAME_CONSUMER_BRIDGE_H_ | |
| OLD | NEW |