Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: remoting/protocol/webrtc_video_capturer_adapter.cc

Issue 1571543002: Implement missing features in WebrtcVideoStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/webrtc_video_capturer_adapter.h ('k') | remoting/protocol/webrtc_video_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_video_capturer_adapter.cc
diff --git a/remoting/protocol/webrtc_video_capturer_adapter.cc b/remoting/protocol/webrtc_video_capturer_adapter.cc
index fcf7972ca44e40dc828080a2a69146866156b2bb..5f735c379d78c95fab7096dca8137e92fc3f10b4 100644
--- a/remoting/protocol/webrtc_video_capturer_adapter.cc
+++ b/remoting/protocol/webrtc_video_capturer_adapter.cc
@@ -18,7 +18,7 @@ const int kFramesPerSec = 30;
WebrtcVideoCapturerAdapter::WebrtcVideoCapturerAdapter(
scoped_ptr<webrtc::DesktopCapturer> capturer)
- : desktop_capturer_(std::move(capturer)) {
+ : desktop_capturer_(std::move(capturer)), weak_factory_(this) {
DCHECK(desktop_capturer_);
// Disable video adaptation since we don't intend to use it.
@@ -29,6 +29,17 @@ WebrtcVideoCapturerAdapter::~WebrtcVideoCapturerAdapter() {
DCHECK(!capture_timer_);
}
+void WebrtcVideoCapturerAdapter::SetSizeCallback(
+ const SizeCallback& size_callback) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ size_callback_ = size_callback;
+}
+
+base::WeakPtr<WebrtcVideoCapturerAdapter>
+WebrtcVideoCapturerAdapter::GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
bool WebrtcVideoCapturerAdapter::GetBestCaptureFormat(
const cricket::VideoFormat& desired,
cricket::VideoFormat* best_format) {
@@ -160,6 +171,9 @@ void WebrtcVideoCapturerAdapter::OnCaptureCompleted(
size_t height = frame->size().height();
if (!yuv_frame_ || yuv_frame_->GetWidth() != width ||
yuv_frame_->GetHeight() != height) {
+ if (!size_callback_.is_null())
+ size_callback_.Run(frame->size());
+
scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame(
new cricket::WebRtcVideoFrame());
webrtc_frame->InitToEmptyBuffer(width, height, 1, 1, 0);
« no previous file with comments | « remoting/protocol/webrtc_video_capturer_adapter.h ('k') | remoting/protocol/webrtc_video_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698