client_video_dispatcher.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2014 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. #ifndef REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
  5. #define REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
  6. #include <list>
  7. #include "base/compiler_specific.h"
  8. #include "base/memory/raw_ptr.h"
  9. #include "base/memory/weak_ptr.h"
  10. #include "remoting/base/constants.h"
  11. #include "remoting/protocol/channel_dispatcher_base.h"
  12. #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
  13. namespace remoting {
  14. namespace protocol {
  15. class ClientStub;
  16. class VideoStub;
  17. class ClientVideoDispatcher : public ChannelDispatcherBase {
  18. public:
  19. ClientVideoDispatcher(VideoStub* video_stub, ClientStub* client_stub);
  20. ClientVideoDispatcher(const ClientVideoDispatcher&) = delete;
  21. ClientVideoDispatcher& operator=(const ClientVideoDispatcher&) = delete;
  22. ~ClientVideoDispatcher() override;
  23. private:
  24. struct PendingFrame;
  25. typedef std::list<PendingFrame> PendingFramesList;
  26. void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
  27. // Callback for VideoStub::ProcessVideoPacket().
  28. void OnPacketDone(PendingFramesList::iterator pending_frame);
  29. PendingFramesList pending_frames_;
  30. raw_ptr<VideoStub> video_stub_;
  31. raw_ptr<ClientStub> client_stub_;
  32. webrtc::DesktopSize screen_size_;
  33. webrtc::DesktopVector screen_dpi_ =
  34. webrtc::DesktopVector(kDefaultDpi, kDefaultDpi);
  35. base::WeakPtrFactory<ClientVideoDispatcher> weak_factory_{this};
  36. };
  37. } // namespace protocol
  38. } // namespace remoting
  39. #endif // REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_