| Index: remoting/host/desktop_session_proxy.h
|
| diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h
|
| index fd0d0a7e66a6f8b1bf7c1ee35e4d00d202199431..16215f6dfd01504eeb088177390379a19de26a25 100644
|
| --- a/remoting/host/desktop_session_proxy.h
|
| +++ b/remoting/host/desktop_session_proxy.h
|
| @@ -15,6 +15,8 @@
|
| #include "ipc/ipc_platform_file.h"
|
| #include "remoting/capturer/shared_buffer.h"
|
| #include "remoting/capturer/video_frame_capturer.h"
|
| +#include "remoting/host/audio_capturer.h"
|
| +#include "remoting/host/desktop_environment.h"
|
| #include "remoting/proto/event.pb.h"
|
| #include "remoting/protocol/clipboard_stub.h"
|
| #include "third_party/skia/include/core/SkRegion.h"
|
| @@ -37,33 +39,59 @@ struct SerializedCapturedData;
|
| namespace remoting {
|
|
|
| class AudioPacket;
|
| +class AudioScheduler;
|
| class ClientSession;
|
| -class IpcAudioCapturer;
|
| class IpcVideoFrameCapturer;
|
| +class VideoScheduler;
|
|
|
| // This class routes calls to the DesktopEnvironment's stubs though the IPC
|
| // channel to the DesktopSessionAgent instance running in the desktop
|
| // integration process.
|
| class DesktopSessionProxy
|
| : public base::RefCountedThreadSafe<DesktopSessionProxy>,
|
| + public DesktopEnvironment,
|
| public IPC::Listener {
|
| public:
|
| DesktopSessionProxy(
|
| - scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner,
|
| scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
|
| - scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner);
|
| + const std::string& client_jid,
|
| + const base::Closure& disconnect_callback);
|
| +
|
| + // protocol::ClipboardStub implementation.
|
| + virtual void InjectClipboardEvent(
|
| + const protocol::ClipboardEvent& event) OVERRIDE;
|
| +
|
| + // protocol::InputStub implementation.
|
| + virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
|
| + virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
|
| +
|
| + // DesktopEnvironment implementation.
|
| + virtual void StartAudio(
|
| + scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
|
| + scoped_ptr<AudioEncoder> audio_encoder,
|
| + protocol::AudioStub* audio_stub) OVERRIDE;
|
| + virtual void PauseAudio(bool pause) OVERRIDE;
|
| + virtual void StartInput(
|
| + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
|
| + protocol::ClipboardStub* clipboard_stub) OVERRIDE;
|
| + virtual void StartVideo(
|
| + scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
|
| + scoped_ptr<VideoEncoder> video_encoder,
|
| + protocol::CursorShapeStub* cursor_shape_stub,
|
| + protocol::VideoStub* video_stub) OVERRIDE;
|
| + virtual SkISize GetScreenSize() const OVERRIDE;
|
| + virtual void PauseVideo(bool pause) OVERRIDE;
|
| + virtual void UpdateSequenceNumber(int64 sequence_number) OVERRIDE;
|
|
|
| // IPC::Listener implementation.
|
| virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
|
| virtual void OnChannelError() OVERRIDE;
|
|
|
| - // Initializes the object. |client_jid| specifies the client session's JID.
|
| - // |disconnect_callback| specifies a callback that disconnects the client
|
| - // session when invoked.
|
| - // Initialize() should be called before AttachToDesktop() is called.
|
| - void Initialize(const std::string& client_jid,
|
| - const base::Closure& disconnect_callback);
|
| + // Stops audio/video schedulers and input handling.
|
| + void Stop();
|
|
|
| // Connects to the desktop session agent.
|
| bool AttachToDesktop(IPC::PlatformFileForTransit desktop_process,
|
| @@ -81,11 +109,11 @@ class DesktopSessionProxy
|
| void InvalidateRegion(const SkRegion& invalid_region);
|
| void CaptureFrame();
|
|
|
| - // Stores |audio_capturer| to be used to post captured audio packets.
|
| - // |audio_capturer| must be valid until StopAudioCapturer() is called.
|
| - void StartAudioCapturer(IpcAudioCapturer* audio_capturer);
|
| + // Stores |audio_packet_callback| to be used to post captured audio packets.
|
| + void StartAudioCapturer(
|
| + const AudioCapturer::PacketCapturedCallback& audio_packet_callback);
|
|
|
| - // Clears the cached pointer to the audio capturer. Any packets captured after
|
| + // Clears |audio_packet_callback_|. Any packets captured after
|
| // StopAudioCapturer() has been called will be silently dropped.
|
| void StopAudioCapturer();
|
|
|
| @@ -97,12 +125,6 @@ class DesktopSessionProxy
|
| // StopVideoCapturer() has been called will be silently dropped.
|
| void StopVideoCapturer();
|
|
|
| - // APIs used to implement the EventExecutor interface.
|
| - void InjectClipboardEvent(const protocol::ClipboardEvent& event);
|
| - void InjectKeyEvent(const protocol::KeyEvent& event);
|
| - void InjectMouseEvent(const protocol::MouseEvent& event);
|
| - void StartEventExecutor(scoped_ptr<protocol::ClipboardStub> client_clipboard);
|
| -
|
| private:
|
| friend class base::RefCountedThreadSafe<DesktopSessionProxy>;
|
| virtual ~DesktopSessionProxy();
|
| @@ -156,11 +178,15 @@ class DesktopSessionProxy
|
| // Task runner on which methods of |video_capturer_| will be invoked.
|
| scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
|
|
|
| - // Points to the audio capturer receiving captured audio packets.
|
| - IpcAudioCapturer* audio_capturer_;
|
| + // Schedulers for audio and video capture.
|
| + scoped_refptr<AudioScheduler> audio_scheduler_;
|
| + scoped_refptr<VideoScheduler> video_scheduler_;
|
| +
|
| + // Invoked when an audio packet was received.
|
| + AudioCapturer::PacketCapturedCallback audio_packet_callback_;
|
|
|
| - // Points to the client stub passed to StartEventExecutor().
|
| - scoped_ptr<protocol::ClipboardStub> client_clipboard_;
|
| + // Points to the client stub passed to StartInput().
|
| + protocol::ClipboardStub* clipboard_stub_;
|
|
|
| // JID of the client session.
|
| std::string client_jid_;
|
|
|