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

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

Issue 1864813002: 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: Addressed comments from PS2, and sampling decision logic change w.r.t. recent animation. 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 08ad2439b0774b0f1ebb26aaf81fc1aa55bf104d..a56208f38aa1fac4fada467d6c43e788d2f207c0 100644
--- a/content/browser/media/capture/aura_window_capture_machine.cc
+++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -9,7 +9,6 @@
#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"
@@ -39,7 +38,6 @@ namespace content {
AuraWindowCaptureMachine::AuraWindowCaptureMachine()
: desktop_window_(NULL),
- timer_(true, true),
screen_capture_(false),
weak_factory_(this) {}
@@ -91,14 +89,6 @@ bool AuraWindowCaptureMachine::InternalStart(
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;
}
@@ -130,12 +120,14 @@ void AuraWindowCaptureMachine::InternalStop(const base::Closure& callback) {
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) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -179,7 +171,7 @@ void AuraWindowCaptureMachine::Capture(bool dirty) {
const base::TimeTicks start_time = base::TimeTicks::Now();
const media::VideoCaptureOracle::Event event =
dirty ? media::VideoCaptureOracle::kCompositorUpdate
- : media::VideoCaptureOracle::kTimerPoll;
+ : media::VideoCaptureOracle::kActiveRefreshRequest;
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