OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/protocol/webrtc_video_stream.h" | 5 #include "remoting/protocol/webrtc_video_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "remoting/protocol/webrtc_video_capturer_adapter.h" | 8 #include "remoting/protocol/webrtc_video_capturer_adapter.h" |
9 #include "third_party/webrtc/api/mediastreaminterface.h" | 9 #include "third_party/webrtc/api/mediastreaminterface.h" |
10 #include "third_party/webrtc/api/peerconnectioninterface.h" | 10 #include "third_party/webrtc/api/peerconnectioninterface.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 connection_->RemoveStream(stream_.get()); | 27 connection_->RemoveStream(stream_.get()); |
28 } | 28 } |
29 | 29 |
30 // MediaStream may still outlive WebrtcVideoStream because it's | 30 // MediaStream may still outlive WebrtcVideoStream because it's |
31 // ref-counted. Reset SizeCallback to make sure it won't be called again. | 31 // ref-counted. Reset SizeCallback to make sure it won't be called again. |
32 if (capturer_adapter_) | 32 if (capturer_adapter_) |
33 capturer_adapter_->SetSizeCallback(SizeCallback()); | 33 capturer_adapter_->SetSizeCallback(SizeCallback()); |
34 } | 34 } |
35 | 35 |
36 bool WebrtcVideoStream::Start( | 36 bool WebrtcVideoStream::Start( |
37 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer, | 37 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, |
38 scoped_refptr<webrtc::PeerConnectionInterface> connection, | 38 scoped_refptr<webrtc::PeerConnectionInterface> connection, |
39 scoped_refptr<webrtc::PeerConnectionFactoryInterface> | 39 scoped_refptr<webrtc::PeerConnectionFactoryInterface> |
40 peer_connection_factory) { | 40 peer_connection_factory) { |
41 scoped_ptr<WebrtcVideoCapturerAdapter> capturer_adapter( | 41 std::unique_ptr<WebrtcVideoCapturerAdapter> capturer_adapter( |
42 new WebrtcVideoCapturerAdapter(std::move(desktop_capturer))); | 42 new WebrtcVideoCapturerAdapter(std::move(desktop_capturer))); |
43 capturer_adapter_ = capturer_adapter->GetWeakPtr(); | 43 capturer_adapter_ = capturer_adapter->GetWeakPtr(); |
44 | 44 |
45 connection_ = connection; | 45 connection_ = connection; |
46 | 46 |
47 // Set video stream constraints. | 47 // Set video stream constraints. |
48 webrtc::FakeConstraints video_constraints; | 48 webrtc::FakeConstraints video_constraints; |
49 video_constraints.AddMandatory( | 49 video_constraints.AddMandatory( |
50 webrtc::MediaConstraintsInterface::kMinFrameRate, 5); | 50 webrtc::MediaConstraintsInterface::kMinFrameRate, 5); |
51 | 51 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 NOTIMPLEMENTED(); | 83 NOTIMPLEMENTED(); |
84 } | 84 } |
85 | 85 |
86 void WebrtcVideoStream::SetSizeCallback(const SizeCallback& size_callback) { | 86 void WebrtcVideoStream::SetSizeCallback(const SizeCallback& size_callback) { |
87 if (capturer_adapter_) | 87 if (capturer_adapter_) |
88 capturer_adapter_->SetSizeCallback(size_callback); | 88 capturer_adapter_->SetSizeCallback(size_callback); |
89 } | 89 } |
90 | 90 |
91 } // namespace protocol | 91 } // namespace protocol |
92 } // namespace remoting | 92 } // namespace remoting |
OLD | NEW |