| OLD | NEW |
| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 const auto reference_it = | 252 const auto reference_it = |
| 253 std::find_if(photo_callbacks_.begin(), photo_callbacks_.end(), | 253 std::find_if(photo_callbacks_.begin(), photo_callbacks_.end(), |
| 254 [cb](const std::unique_ptr<TakePhotoCallback>& callback) { | 254 [cb](const std::unique_ptr<TakePhotoCallback>& callback) { |
| 255 return callback.get() == cb; | 255 return callback.get() == cb; |
| 256 }); | 256 }); |
| 257 if (reference_it == photo_callbacks_.end()) { | 257 if (reference_it == photo_callbacks_.end()) { |
| 258 NOTREACHED() << "|callback_id| not found."; | 258 NOTREACHED() << "|callback_id| not found."; |
| 259 return; | 259 return; |
| 260 } | 260 } |
| 261 | 261 |
| 262 std::vector<uint8_t> native_data; | 262 mojom::BlobPtr blob = mojom::Blob::New(); |
| 263 base::android::JavaByteArrayToByteVector(env, data.obj(), &native_data); | 263 base::android::JavaByteArrayToByteVector(env, data.obj(), &blob->data); |
| 264 | 264 blob->mime_type = blob->data.empty() ? "" : "image/jpeg"; |
| 265 cb->Run(std::string(native_data.empty() ? "" : "image/jpeg"), native_data); | 265 cb->Run(std::move(blob)); |
| 266 | 266 |
| 267 photo_callbacks_.erase(reference_it); | 267 photo_callbacks_.erase(reference_it); |
| 268 } | 268 } |
| 269 | 269 |
| 270 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { | 270 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { |
| 271 JNIEnv* env = AttachCurrentThread(); | 271 JNIEnv* env = AttachCurrentThread(); |
| 272 const int current_capture_colorspace = | 272 const int current_capture_colorspace = |
| 273 Java_VideoCapture_getColorspace(env, j_capture_.obj()); | 273 Java_VideoCapture_getColorspace(env, j_capture_.obj()); |
| 274 switch (current_capture_colorspace) { | 274 switch (current_capture_colorspace) { |
| 275 case ANDROID_IMAGE_FORMAT_YV12: | 275 case ANDROID_IMAGE_FORMAT_YV12: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 288 const tracked_objects::Location& from_here, | 288 const tracked_objects::Location& from_here, |
| 289 const std::string& reason) { | 289 const std::string& reason) { |
| 290 { | 290 { |
| 291 base::AutoLock lock(lock_); | 291 base::AutoLock lock(lock_); |
| 292 state_ = kError; | 292 state_ = kError; |
| 293 } | 293 } |
| 294 client_->OnError(from_here, reason); | 294 client_->OnError(from_here, reason); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace media | 297 } // namespace media |
| OLD | NEW |