OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/capture/content/android/screen_capture_machine_android.h" | 5 #include "media/capture/content/android/screen_capture_machine_android.h" |
6 | 6 |
7 #include "base/android/context_utils.h" | 7 #include "base/android/context_utils.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "jni/ScreenCapture_jni.h" | 10 #include "jni/ScreenCapture_jni.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 DLOG(ERROR) << "Failed to createScreenCaptureAndroid"; | 213 DLOG(ERROR) << "Failed to createScreenCaptureAndroid"; |
214 callback.Run(false); | 214 callback.Run(false); |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 DCHECK(params.requested_format.frame_size.GetArea()); | 218 DCHECK(params.requested_format.frame_size.GetArea()); |
219 DCHECK(!(params.requested_format.frame_size.width() % 2)); | 219 DCHECK(!(params.requested_format.frame_size.width() % 2)); |
220 DCHECK(!(params.requested_format.frame_size.height() % 2)); | 220 DCHECK(!(params.requested_format.frame_size.height() % 2)); |
221 | 221 |
222 const jboolean ret = Java_ScreenCapture_startPrompt( | 222 const jboolean ret = Java_ScreenCapture_startPrompt( |
223 AttachCurrentThread(), j_capture_.obj(), | 223 AttachCurrentThread(), j_capture_, |
224 params.requested_format.frame_size.width(), | 224 params.requested_format.frame_size.width(), |
225 params.requested_format.frame_size.height()); | 225 params.requested_format.frame_size.height()); |
226 | 226 |
227 callback.Run(ret); | 227 callback.Run(ret); |
228 } | 228 } |
229 | 229 |
230 void ScreenCaptureMachineAndroid::Stop(const base::Closure& callback) { | 230 void ScreenCaptureMachineAndroid::Stop(const base::Closure& callback) { |
231 Java_ScreenCapture_stopCapture(AttachCurrentThread(), j_capture_.obj()); | 231 Java_ScreenCapture_stopCapture(AttachCurrentThread(), j_capture_); |
232 | 232 |
233 callback.Run(); | 233 callback.Run(); |
234 } | 234 } |
235 | 235 |
236 // ScreenCapture on Android works in a passive way and there are no captured | 236 // ScreenCapture on Android works in a passive way and there are no captured |
237 // frames when there is no update to the screen. When the oracle asks for a | 237 // frames when there is no update to the screen. When the oracle asks for a |
238 // capture refresh, the cached captured frame is redelivered. | 238 // capture refresh, the cached captured frame is redelivered. |
239 void ScreenCaptureMachineAndroid::MaybeCaptureForRefresh() { | 239 void ScreenCaptureMachineAndroid::MaybeCaptureForRefresh() { |
240 if (lastFrame_.get() == nullptr) | 240 if (lastFrame_.get() == nullptr) |
241 return; | 241 return; |
(...skipping 25 matching lines...) Expand all Loading... |
267 frame->visible_data(VideoFrame::kUPlane), | 267 frame->visible_data(VideoFrame::kUPlane), |
268 frame->stride(VideoFrame::kUPlane), | 268 frame->stride(VideoFrame::kUPlane), |
269 frame->visible_data(VideoFrame::kVPlane), | 269 frame->visible_data(VideoFrame::kVPlane), |
270 frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(), | 270 frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(), |
271 frame->visible_rect().height(), libyuv::kFilterBilinear); | 271 frame->visible_rect().height(), libyuv::kFilterBilinear); |
272 | 272 |
273 capture_frame_cb.Run(frame, start_time, true); | 273 capture_frame_cb.Run(frame, start_time, true); |
274 } | 274 } |
275 | 275 |
276 } // namespace media | 276 } // namespace media |
OLD | NEW |