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

Side by Side Diff: media/capture/video/android/video_capture_device_android.cc

Issue 2286303003: Video capture Android: enable unittests for Camera2 API (Closed)
Patch Set: jbudorick@s comments Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/video/android/video_capture_device_android.h" 5 #include "media/capture/video/android/video_capture_device_android.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 376 }
377 377
378 mojom::BlobPtr blob = mojom::Blob::New(); 378 mojom::BlobPtr blob = mojom::Blob::New();
379 base::android::JavaByteArrayToByteVector(env, data.obj(), &blob->data); 379 base::android::JavaByteArrayToByteVector(env, data.obj(), &blob->data);
380 blob->mime_type = blob->data.empty() ? "" : "image/jpeg"; 380 blob->mime_type = blob->data.empty() ? "" : "image/jpeg";
381 cb->Run(std::move(blob)); 381 cb->Run(std::move(blob));
382 382
383 photo_callbacks_.erase(reference_it); 383 photo_callbacks_.erase(reference_it);
384 } 384 }
385 385
386 void VideoCaptureDeviceAndroid::ConfigureForTesting() {
387 Java_VideoCapture_setTestMode(AttachCurrentThread(), j_capture_);
388 }
389
386 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { 390 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() {
387 JNIEnv* env = AttachCurrentThread(); 391 JNIEnv* env = AttachCurrentThread();
388 const int current_capture_colorspace = 392 const int current_capture_colorspace =
389 Java_VideoCapture_getColorspace(env, j_capture_); 393 Java_VideoCapture_getColorspace(env, j_capture_);
390 switch (current_capture_colorspace) { 394 switch (current_capture_colorspace) {
391 case ANDROID_IMAGE_FORMAT_YV12: 395 case ANDROID_IMAGE_FORMAT_YV12:
392 return media::PIXEL_FORMAT_YV12; 396 return media::PIXEL_FORMAT_YV12;
393 case ANDROID_IMAGE_FORMAT_YUV_420_888: 397 case ANDROID_IMAGE_FORMAT_YUV_420_888:
394 return media::PIXEL_FORMAT_I420; 398 return media::PIXEL_FORMAT_I420;
395 case ANDROID_IMAGE_FORMAT_NV21: 399 case ANDROID_IMAGE_FORMAT_NV21:
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 529
526 Java_VideoCapture_setPhotoOptions( 530 Java_VideoCapture_setPhotoOptions(
527 env, j_capture_, zoom, static_cast<int>(focus_mode), 531 env, j_capture_, zoom, static_cast<int>(focus_mode),
528 static_cast<int>(exposure_mode), width, height, points_of_interest, 532 static_cast<int>(exposure_mode), width, height, points_of_interest,
529 settings->has_exposure_compensation, exposure_compensation); 533 settings->has_exposure_compensation, exposure_compensation);
530 534
531 callback.Run(true); 535 callback.Run(true);
532 } 536 }
533 537
534 } // namespace media 538 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698