summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/webrtc_video_stream.h
blob: 83d71cd3eea50ff95d3e5627903ff0379c5c29e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_
#define REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_

#include <stdint.h>

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "remoting/protocol/video_stream.h"

namespace webrtc {
class DesktopSize;
class DesktopCapturer;
class MediaStreamInterface;
class PeerConnectionInterface;
class PeerConnectionFactoryInterface;
class VideoTrackInterface;
}  // namespace webrtc

namespace remoting {
namespace protocol {

class WebrtcVideoCapturerAdapter;

class WebrtcVideoStream : public VideoStream {
 public:
  WebrtcVideoStream();
  ~WebrtcVideoStream() override;

  bool Start(scoped_ptr<webrtc::DesktopCapturer> desktop_capturer,
             scoped_refptr<webrtc::PeerConnectionInterface> connection,
             scoped_refptr<webrtc::PeerConnectionFactoryInterface>
                 peer_connection_factory);

  // VideoStream interface.
  void Pause(bool pause) override;
  void OnInputEventReceived(int64_t event_timestamp) override;
  void SetLosslessEncode(bool want_lossless) override;
  void SetLosslessColor(bool want_lossless) override;
  void SetSizeCallback(const SizeCallback& size_callback) override;

 private:
  scoped_refptr<webrtc::PeerConnectionInterface> connection_;
  scoped_refptr<webrtc::MediaStreamInterface> stream_;

  // Owned by the |stream_|.
  base::WeakPtr<WebrtcVideoCapturerAdapter> capturer_adapter_;

  DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream);
};

}  // namespace protocol
}  // namespace remoting

#endif  // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_