summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-11-24 14:07:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-24 22:08:49 +0000
commit2536ddbba72ac599fe2bcedf2b9c29cb0d292dc9 (patch)
treec174c9ff5c118b12292b7d6b8f19a348f625c994 /remoting
parentca374497a82e6bf64922d80f4e85e163c0489a64 (diff)
downloadchromium_src-2536ddbba72ac599fe2bcedf2b9c29cb0d292dc9.zip
chromium_src-2536ddbba72ac599fe2bcedf2b9c29cb0d292dc9.tar.gz
chromium_src-2536ddbba72ac599fe2bcedf2b9c29cb0d292dc9.tar.bz2
Move and rename host/cast_video_capture_adapter to protocol/webrtc_video_capture_adapter
The adapter will be used in the protocol layer for WebRTC-based connections. BUG=547158 Review URL: https://codereview.chromium.org/1472703006 Cr-Commit-Position: refs/heads/master@{#361465}
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/cast_extension_session.cc8
-rw-r--r--remoting/protocol/BUILD.gn5
-rw-r--r--remoting/protocol/webrtc_video_capturer_adapter.cc (renamed from remoting/host/cast_video_capturer_adapter.cc)46
-rw-r--r--remoting/protocol/webrtc_video_capturer_adapter.h (renamed from remoting/host/cast_video_capturer_adapter.h)22
-rw-r--r--remoting/remoting_host_srcs.gypi2
-rw-r--r--remoting/remoting_srcs.gypi2
6 files changed, 44 insertions, 41 deletions
diff --git a/remoting/host/cast_extension_session.cc b/remoting/host/cast_extension_session.cc
index 5b7e9a6..1b8df91 100644
--- a/remoting/host/cast_extension_session.cc
+++ b/remoting/host/cast_extension_session.cc
@@ -10,11 +10,11 @@
#include "base/logging.h"
#include "base/synchronization/waitable_event.h"
#include "net/url_request/url_request_context_getter.h"
-#include "remoting/host/cast_video_capturer_adapter.h"
#include "remoting/host/client_session.h"
#include "remoting/proto/control.pb.h"
#include "remoting/protocol/chromium_port_allocator_factory.h"
#include "remoting/protocol/client_stub.h"
+#include "remoting/protocol/webrtc_video_capturer_adapter.h"
#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
#include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h"
#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
@@ -535,8 +535,8 @@ bool CastExtensionSession::SetupVideoStream(
return false;
}
- scoped_ptr<CastVideoCapturerAdapter> cast_video_capturer_adapter(
- new CastVideoCapturerAdapter(desktop_capturer.Pass()));
+ scoped_ptr<WebrtcVideoCapturerAdapter> video_capturer_adapter(
+ new WebrtcVideoCapturerAdapter(desktop_capturer.Pass()));
// Set video stream constraints.
webrtc::FakeConstraints video_constraints;
@@ -547,7 +547,7 @@ bool CastExtensionSession::SetupVideoStream(
peer_conn_factory_->CreateVideoTrack(
kVideoLabel,
peer_conn_factory_->CreateVideoSource(
- cast_video_capturer_adapter.release(), &video_constraints));
+ video_capturer_adapter.release(), &video_constraints));
stream_ = peer_conn_factory_->CreateLocalMediaStream(kStreamLabel);
diff --git a/remoting/protocol/BUILD.gn b/remoting/protocol/BUILD.gn
index e6a812e..b88785c 100644
--- a/remoting/protocol/BUILD.gn
+++ b/remoting/protocol/BUILD.gn
@@ -45,7 +45,10 @@ source_set("protocol") {
"//third_party/libjingle:libpeerconnection",
]
} else {
- sources -= [ "webrtc_transport.cc" ]
+ sources -= [
+ "webrtc_transport.cc",
+ "webrtc_video_capturer_adapter.cc",
+ ]
}
}
}
diff --git a/remoting/host/cast_video_capturer_adapter.cc b/remoting/protocol/webrtc_video_capturer_adapter.cc
index 2c29663..9bf51ed 100644
--- a/remoting/host/cast_video_capturer_adapter.cc
+++ b/remoting/protocol/webrtc_video_capturer_adapter.cc
@@ -1,8 +1,8 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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.
-#include "remoting/host/cast_video_capturer_adapter.h"
+#include "remoting/protocol/webrtc_video_capturer_adapter.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
@@ -11,7 +11,7 @@ namespace remoting {
// Number of frames to be captured per second.
const int kFramesPerSec = 10;
-CastVideoCapturerAdapter::CastVideoCapturerAdapter(
+WebrtcVideoCapturerAdapter::WebrtcVideoCapturerAdapter(
scoped_ptr<webrtc::DesktopCapturer> capturer)
: desktop_capturer_(capturer.Pass()) {
DCHECK(desktop_capturer_);
@@ -22,16 +22,17 @@ CastVideoCapturerAdapter::CastVideoCapturerAdapter(
set_enable_video_adapter(false);
}
-CastVideoCapturerAdapter::~CastVideoCapturerAdapter() {
+WebrtcVideoCapturerAdapter::~WebrtcVideoCapturerAdapter() {
DCHECK(!capture_timer_);
}
-webrtc::SharedMemory* CastVideoCapturerAdapter::CreateSharedMemory(
+webrtc::SharedMemory* WebrtcVideoCapturerAdapter::CreateSharedMemory(
size_t size) {
return nullptr;
}
-void CastVideoCapturerAdapter::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
+void WebrtcVideoCapturerAdapter::OnCaptureCompleted(
+ webrtc::DesktopFrame* frame) {
scoped_ptr<webrtc::DesktopFrame> owned_frame(frame);
// Drop the owned_frame if there were no changes.
@@ -59,7 +60,7 @@ void CastVideoCapturerAdapter::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
SignalFrameCaptured(this, &captured_frame);
}
-bool CastVideoCapturerAdapter::GetBestCaptureFormat(
+bool WebrtcVideoCapturerAdapter::GetBestCaptureFormat(
const cricket::VideoFormat& desired,
cricket::VideoFormat* best_format) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -72,14 +73,14 @@ bool CastVideoCapturerAdapter::GetBestCaptureFormat(
return true;
}
-cricket::CaptureState CastVideoCapturerAdapter::Start(
+cricket::CaptureState WebrtcVideoCapturerAdapter::Start(
const cricket::VideoFormat& capture_format) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!capture_timer_);
DCHECK_EQ(capture_format.fourcc, (static_cast<uint32>(cricket::FOURCC_ARGB)));
if (!desktop_capturer_) {
- VLOG(1) << "CastVideoCapturerAdapter failed to start.";
+ VLOG(1) << "WebrtcVideoCapturerAdapter failed to start.";
return cricket::CS_FAILED;
}
@@ -95,7 +96,7 @@ cricket::CaptureState CastVideoCapturerAdapter::Start(
GetCaptureFormat()->interval /
(base::Time::kNanosecondsPerMicrosecond)),
this,
- &CastVideoCapturerAdapter::CaptureNextFrame);
+ &WebrtcVideoCapturerAdapter::CaptureNextFrame);
return cricket::CS_RUNNING;
}
@@ -105,7 +106,7 @@ cricket::CaptureState CastVideoCapturerAdapter::Start(
// |desktop_capturer_|.
// 2. Does not support unpausing after stopping the capturer. It is unclear
// if that flow needs to be supported.
-bool CastVideoCapturerAdapter::Pause(bool pause) {
+bool WebrtcVideoCapturerAdapter::Pause(bool pause) {
DCHECK(thread_checker_.CalledOnValidThread());
if (pause) {
@@ -119,7 +120,7 @@ bool CastVideoCapturerAdapter::Pause(bool pause) {
if (!running) {
LOG(ERROR)
- << "Cannot pause CastVideoCapturerAdapter.";
+ << "Cannot pause WebrtcVideoCapturerAdapter.";
return false;
}
@@ -127,13 +128,13 @@ bool CastVideoCapturerAdapter::Pause(bool pause) {
capture_timer_->Stop();
SetCaptureState(cricket::CS_PAUSED);
- VLOG(1) << "CastVideoCapturerAdapter paused.";
+ VLOG(1) << "WebrtcVideoCapturerAdapter paused.";
return true;
} else { // Unpausing.
if (capture_state() != cricket::CS_PAUSED || !GetCaptureFormat() ||
!capture_timer_) {
- LOG(ERROR) << "Cannot unpause CastVideoCapturerAdapter.";
+ LOG(ERROR) << "Cannot unpause WebrtcVideoCapturerAdapter.";
return false;
}
@@ -143,15 +144,15 @@ bool CastVideoCapturerAdapter::Pause(bool pause) {
GetCaptureFormat()->interval /
(base::Time::kNanosecondsPerMicrosecond)),
this,
- &CastVideoCapturerAdapter::CaptureNextFrame);
+ &WebrtcVideoCapturerAdapter::CaptureNextFrame);
SetCaptureState(cricket::CS_RUNNING);
- VLOG(1) << "CastVideoCapturerAdapter unpaused.";
+ VLOG(1) << "WebrtcVideoCapturerAdapter unpaused.";
}
return true;
}
-void CastVideoCapturerAdapter::Stop() {
+void WebrtcVideoCapturerAdapter::Stop() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_NE(capture_state(), cricket::CS_STOPPED);
@@ -160,21 +161,21 @@ void CastVideoCapturerAdapter::Stop() {
SetCaptureFormat(nullptr);
SetCaptureState(cricket::CS_STOPPED);
- VLOG(1) << "CastVideoCapturerAdapter stopped.";
+ VLOG(1) << "WebrtcVideoCapturerAdapter stopped.";
}
-bool CastVideoCapturerAdapter::IsRunning() {
+bool WebrtcVideoCapturerAdapter::IsRunning() {
DCHECK(thread_checker_.CalledOnValidThread());
return capture_timer_->IsRunning();
}
-bool CastVideoCapturerAdapter::IsScreencast() const {
+bool WebrtcVideoCapturerAdapter::IsScreencast() const {
return true;
}
-bool CastVideoCapturerAdapter::GetPreferredFourccs(
+bool WebrtcVideoCapturerAdapter::GetPreferredFourccs(
std::vector<uint32>* fourccs) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!fourccs)
@@ -183,7 +184,7 @@ bool CastVideoCapturerAdapter::GetPreferredFourccs(
return true;
}
-void CastVideoCapturerAdapter::CaptureNextFrame() {
+void WebrtcVideoCapturerAdapter::CaptureNextFrame() {
// If we are paused, then don't capture.
if (!IsRunning())
return;
@@ -192,4 +193,3 @@ void CastVideoCapturerAdapter::CaptureNextFrame() {
}
} // namespace remoting
-
diff --git a/remoting/host/cast_video_capturer_adapter.h b/remoting/protocol/webrtc_video_capturer_adapter.h
index 88d47ff..9c46178 100644
--- a/remoting/host/cast_video_capturer_adapter.h
+++ b/remoting/protocol/webrtc_video_capturer_adapter.h
@@ -1,9 +1,9 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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_HOST_CAST_VIDEO_CAPTURER_ADAPTER_H_
-#define REMOTING_HOST_CAST_VIDEO_CAPTURER_ADAPTER_H_
+#ifndef REMOTING_PROTOCOL_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_
+#define REMOTING_PROTOCOL_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_
#include <vector>
@@ -12,7 +12,7 @@
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "third_party/libjingle/source/talk/media/base/videocapturer.h"
-#include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
+#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
namespace base {
class SingleThreadTaskRunner;
@@ -26,18 +26,18 @@ namespace remoting {
// This class controls the capture of video frames from the desktop and is used
// to construct a VideoSource as part of the webrtc PeerConnection API.
-// CastVideoCapturerAdapter acts as an adapter between webrtc::DesktopCapturer
+// WebrtcVideoCapturerAdapter acts as an adapter between webrtc::DesktopCapturer
// and the cricket::VideoCapturer interface, which it implements. It is used
// to construct a cricket::VideoSource for a PeerConnection, to capture frames
// of the desktop. As indicated in the base implementation, Start() and Stop()
// should be called on the same thread.
-class CastVideoCapturerAdapter : public cricket::VideoCapturer,
- public webrtc::DesktopCapturer::Callback {
+class WebrtcVideoCapturerAdapter : public cricket::VideoCapturer,
+ public webrtc::DesktopCapturer::Callback {
public:
- explicit CastVideoCapturerAdapter(
+ explicit WebrtcVideoCapturerAdapter(
scoped_ptr<webrtc::DesktopCapturer> capturer);
- ~CastVideoCapturerAdapter() override;
+ ~WebrtcVideoCapturerAdapter() override;
// webrtc::DesktopCapturer::Callback implementation.
webrtc::SharedMemory* CreateSharedMemory(size_t size) override;
@@ -70,10 +70,10 @@ class CastVideoCapturerAdapter : public cricket::VideoCapturer,
// Used to schedule periodic screen captures.
scoped_ptr<base::RepeatingTimer> capture_timer_;
- DISALLOW_COPY_AND_ASSIGN(CastVideoCapturerAdapter);
+ DISALLOW_COPY_AND_ASSIGN(WebrtcVideoCapturerAdapter);
};
} // namespace remoting
-#endif // REMOTING_HOST_CAST_VIDEO_CAPTURER_ADAPTER_H_
+#endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_CAPTURER_ADAPTER_H_
diff --git a/remoting/remoting_host_srcs.gypi b/remoting/remoting_host_srcs.gypi
index a699670..f806865 100644
--- a/remoting/remoting_host_srcs.gypi
+++ b/remoting/remoting_host_srcs.gypi
@@ -320,8 +320,6 @@
'host/cast_extension.h',
'host/cast_extension_session.cc',
'host/cast_extension_session.h',
- 'host/cast_video_capturer_adapter.cc',
- 'host/cast_video_capturer_adapter.h',
],
'remoting_it2me_host_static_sources' : [
'host/it2me/it2me_confirmation_dialog.cc',
diff --git a/remoting/remoting_srcs.gypi b/remoting/remoting_srcs.gypi
index 1ba30ee..faf4efb 100644
--- a/remoting/remoting_srcs.gypi
+++ b/remoting/remoting_srcs.gypi
@@ -218,6 +218,8 @@
'protocol/video_frame_pump.h',
'protocol/webrtc_transport.cc',
'protocol/webrtc_transport.h',
+ 'protocol/webrtc_video_capturer_adapter.cc',
+ 'protocol/webrtc_video_capturer_adapter.h',
],
'remoting_signaling_sources': [