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

Side by Side Diff: remoting/protocol/webrtc_video_capturer_adapter.cc

Issue 1740443002: Fix WebrtcVideoCapturerAdapter to emit frames even when nothing is changing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_capturer_adapter.h" 5 #include "remoting/protocol/webrtc_video_capturer_adapter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "third_party/libyuv/include/libyuv/convert.h" 9 #include "third_party/libyuv/include/libyuv/convert.h"
10 #include "third_party/webrtc/media/engine/webrtcvideoframe.h" 10 #include "third_party/webrtc/media/engine/webrtcvideoframe.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return nullptr; 154 return nullptr;
155 } 155 }
156 156
157 void WebrtcVideoCapturerAdapter::OnCaptureCompleted( 157 void WebrtcVideoCapturerAdapter::OnCaptureCompleted(
158 webrtc::DesktopFrame* frame) { 158 webrtc::DesktopFrame* frame) {
159 DCHECK(thread_checker_.CalledOnValidThread()); 159 DCHECK(thread_checker_.CalledOnValidThread());
160 160
161 DCHECK(capture_pending_); 161 DCHECK(capture_pending_);
162 capture_pending_ = false; 162 capture_pending_ = false;
163 163
164 if (!frame)
Jamie 2016/02/24 23:31:38 If this is a stop-gap solution, does it warrant a
Sergey Ulanov 2016/02/25 00:50:15 Done.
165 return;
166
164 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame); 167 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame);
165 168
166 // Drop the frame if there were no changes.
167 if (!owned_frame || owned_frame->updated_region().is_empty())
168 return;
169
170 size_t width = frame->size().width(); 169 size_t width = frame->size().width();
171 size_t height = frame->size().height(); 170 size_t height = frame->size().height();
172 if (!yuv_frame_ || yuv_frame_->GetWidth() != width || 171 if (!yuv_frame_ || yuv_frame_->GetWidth() != width ||
173 yuv_frame_->GetHeight() != height) { 172 yuv_frame_->GetHeight() != height) {
174 if (!size_callback_.is_null()) 173 if (!size_callback_.is_null())
175 size_callback_.Run(frame->size()); 174 size_callback_.Run(frame->size());
176 175
177 scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame( 176 scoped_ptr<cricket::WebRtcVideoFrame> webrtc_frame(
178 new cricket::WebRtcVideoFrame()); 177 new cricket::WebRtcVideoFrame());
179 webrtc_frame->InitToEmptyBuffer(width, height, 0); 178 webrtc_frame->InitToEmptyBuffer(width, height, 0);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 DCHECK(thread_checker_.CalledOnValidThread()); 224 DCHECK(thread_checker_.CalledOnValidThread());
226 225
227 if (capture_pending_) 226 if (capture_pending_)
228 return; 227 return;
229 capture_pending_ = true; 228 capture_pending_ = true;
230 desktop_capturer_->Capture(webrtc::DesktopRegion()); 229 desktop_capturer_->Capture(webrtc::DesktopRegion());
231 } 230 }
232 231
233 } // namespace protocol 232 } // namespace protocol
234 } // namespace remoting 233 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698