| 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 | 9 |
| 9 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
| 11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 12 #include "jni/VideoCapture_jni.h" | 13 #include "jni/VideoCapture_jni.h" |
| 13 #include "media/capture/video/android/video_capture_device_factory_android.h" | 14 #include "media/capture/video/android/video_capture_device_factory_android.h" |
| 14 | 15 |
| 15 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
| 16 using base::android::CheckException; | 17 using base::android::CheckException; |
| 17 using base::android::GetClass; | 18 using base::android::GetClass; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 53 } |
| 53 | 54 |
| 54 void VideoCaptureDeviceAndroid::AllocateAndStart( | 55 void VideoCaptureDeviceAndroid::AllocateAndStart( |
| 55 const VideoCaptureParams& params, | 56 const VideoCaptureParams& params, |
| 56 scoped_ptr<Client> client) { | 57 scoped_ptr<Client> client) { |
| 57 DVLOG(1) << "VideoCaptureDeviceAndroid::AllocateAndStart"; | 58 DVLOG(1) << "VideoCaptureDeviceAndroid::AllocateAndStart"; |
| 58 { | 59 { |
| 59 base::AutoLock lock(lock_); | 60 base::AutoLock lock(lock_); |
| 60 if (state_ != kIdle) | 61 if (state_ != kIdle) |
| 61 return; | 62 return; |
| 62 client_ = client.Pass(); | 63 client_ = std::move(client); |
| 63 got_first_frame_ = false; | 64 got_first_frame_ = false; |
| 64 } | 65 } |
| 65 | 66 |
| 66 JNIEnv* env = AttachCurrentThread(); | 67 JNIEnv* env = AttachCurrentThread(); |
| 67 | 68 |
| 68 jboolean ret = Java_VideoCapture_allocate( | 69 jboolean ret = Java_VideoCapture_allocate( |
| 69 env, j_capture_.obj(), params.requested_format.frame_size.width(), | 70 env, j_capture_.obj(), params.requested_format.frame_size.width(), |
| 70 params.requested_format.frame_size.height(), | 71 params.requested_format.frame_size.height(), |
| 71 params.requested_format.frame_rate); | 72 params.requested_format.frame_rate); |
| 72 if (!ret) { | 73 if (!ret) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 const tracked_objects::Location& from_here, | 200 const tracked_objects::Location& from_here, |
| 200 const std::string& reason) { | 201 const std::string& reason) { |
| 201 { | 202 { |
| 202 base::AutoLock lock(lock_); | 203 base::AutoLock lock(lock_); |
| 203 state_ = kError; | 204 state_ = kError; |
| 204 } | 205 } |
| 205 client_->OnError(from_here, reason); | 206 client_->OnError(from_here, reason); |
| 206 } | 207 } |
| 207 | 208 |
| 208 } // namespace media | 209 } // namespace media |
| OLD | NEW |