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

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

Issue 1917023003: ScreenCapture for Android phase1, part I (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: relocate java files, support YUV format and improve JNI operation Created 4 years, 7 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/screen_capture_device_android.cc
diff --git a/content/browser/media/capture/screen_capture_device_android.cc b/content/browser/media/capture/screen_capture_device_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ee5beadb25ad146fdfc5bf18dbc335e680e5aeac
--- /dev/null
+++ b/content/browser/media/capture/screen_capture_device_android.cc
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/media/capture/screen_capture_device_android.h"
+
+#include "base/logging.h"
+#include "base/memory/ptr_util.h"
+#include "media/capture/content/android/screen_capture_machine_android.h"
+
+namespace content {
+
+ScreenCaptureDeviceAndroid::ScreenCaptureDeviceAndroid()
+ : core_(new media::ScreenCaptureDeviceCore(
+ base::WrapUnique(new media::ScreenCaptureMachineAndroid()))) {}
+
+ScreenCaptureDeviceAndroid::~ScreenCaptureDeviceAndroid() {
+ DVLOG(2) << "ScreenCaptureDeviceAndroid@" << this << " destroying.";
+}
+
+// static
+std::unique_ptr<media::VideoCaptureDevice>
+ScreenCaptureDeviceAndroid::Create() {
+ return std::unique_ptr<media::VideoCaptureDevice>(
mcasas 2016/05/19 19:11:39 Consider base::WrapUnique(), however see my next
braveyao 2016/05/20 22:27:24 Done.
+ new ScreenCaptureDeviceAndroid());
mcasas 2016/05/19 19:11:39 If we're just returning a new ScreenCaptureDeviceA
braveyao 2016/05/20 22:27:24 In video_capture_manager.cc, all other capture ins
+}
+
+void ScreenCaptureDeviceAndroid::AllocateAndStart(
+ const media::VideoCaptureParams& params,
+ std::unique_ptr<Client> client) {
+ DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
+ core_->AllocateAndStart(params, std::move(client));
+
+ power_save_blocker_.reset(
+ content::PowerSaveBlocker::Create(
+ content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
+ content::PowerSaveBlocker::kReasonOther,
+ "ScreenCaptureMachineAndroid is running")
+ .release());
mcasas 2016/05/19 19:11:39 Strange somersault? Consider: power_save_blocker_
braveyao 2016/05/20 22:27:24 Done. I see "power_save_blocker_ = PowerSaverBloc
mcasas 2016/05/23 18:19:55 I don't understand this response.
braveyao 2016/05/24 00:03:26 Some people use "power_save_blocker_.reset(PowerSa
+}
+
+void ScreenCaptureDeviceAndroid::StopAndDeAllocate() {
+ power_save_blocker_.reset();
+ core_->StopAndDeAllocate();
+}
+
+void ScreenCaptureDeviceAndroid::RequestRefreshFrame() {
+ core_->RequestRefreshFrame();
+}
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698