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

Unified Diff: content/browser/media/capture/aura_window_capture_machine.cc

Issue 1865283003: Revert of Tab/Desktop Capture: Use requests instead of timer-based refreshing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_refresh_from_sinks
Patch Set: Created 4 years, 8 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
Index: content/browser/media/capture/aura_window_capture_machine.cc
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc
index a56208f38aa1fac4fada467d6c43e788d2f207c0..08ad2439b0774b0f1ebb26aaf81fc1aa55bf104d 100644
--- a/content/browser/media/capture/aura_window_capture_machine.cc
+++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/timer/timer.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
#include "content/browser/compositor/gl_helper.h"
@@ -38,6 +39,7 @@
AuraWindowCaptureMachine::AuraWindowCaptureMachine()
: desktop_window_(NULL),
+ timer_(true, true),
screen_capture_(false),
weak_factory_(this) {}
@@ -89,6 +91,14 @@
PowerSaveBlocker::kReasonOther,
"DesktopCaptureDevice is running").release());
+ // Starts timer.
+ timer_.Start(FROM_HERE,
+ std::max(oracle_proxy_->min_capture_period(),
+ base::TimeDelta::FromMilliseconds(media::
+ VideoCaptureOracle::kMinTimerPollPeriodMillis)),
+ base::Bind(&AuraWindowCaptureMachine::Capture,
+ base::Unretained(this), false));
+
return true;
}
@@ -120,12 +130,10 @@
cursor_renderer_.reset();
}
+ // Stop timer.
+ timer_.Stop();
+
callback.Run();
-}
-
-void AuraWindowCaptureMachine::MaybeCaptureForRefresh() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- Capture(false);
}
void AuraWindowCaptureMachine::SetWindow(aura::Window* window) {
@@ -171,7 +179,7 @@
const base::TimeTicks start_time = base::TimeTicks::Now();
const media::VideoCaptureOracle::Event event =
dirty ? media::VideoCaptureOracle::kCompositorUpdate
- : media::VideoCaptureOracle::kActiveRefreshRequest;
+ : media::VideoCaptureOracle::kTimerPoll;
if (oracle_proxy_->ObserveEventAndDecideCapture(
event, gfx::Rect(), start_time, &frame, &capture_frame_cb)) {
scoped_ptr<cc::CopyOutputRequest> request =

Powered by Google App Engine
This is Rietveld 408576698