Do not call CaptureCursor in ScreenCapturerWinGdi if no MouseShapeObserver.

It's wasted work and affects frame rate adaptation in Chrome.

BUG=
R=sergeyu@chromium.org

Review URL: https://webrtc-codereview.appspot.com/19789004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6499 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
jiayl@webrtc.org 2014-06-19 22:04:41 +00:00
parent df9bbbee56
commit 594aefa807

View File

@ -133,7 +133,8 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
callback_->OnCaptureCompleted(frame);
// Check for cursor shape update.
CaptureCursor();
if (mouse_shape_observer_)
CaptureCursor();
}
void ScreenCapturerWinGdi::SetMouseShapeObserver(
@ -279,6 +280,8 @@ bool ScreenCapturerWinGdi::CaptureImage() {
}
void ScreenCapturerWinGdi::CaptureCursor() {
assert(mouse_shape_observer_);
CURSORINFO cursor_info;
cursor_info.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&cursor_info)) {
@ -317,8 +320,7 @@ void ScreenCapturerWinGdi::CaptureCursor() {
// Record the last cursor image that we sent to the client.
last_cursor_ = *cursor;
if (mouse_shape_observer_)
mouse_shape_observer_->OnCursorShapeChanged(cursor.release());
mouse_shape_observer_->OnCursorShapeChanged(cursor.release());
}
} // namespace webrtc