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/video/capture/android/video_capture_device_android.h" | 5 #include "media/video/capture/android/video_capture_device_android.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 expected_next_frame_time_ = current_time - frame_interval_; | 215 expected_next_frame_time_ = current_time - frame_interval_; |
216 got_first_frame_ = true; | 216 got_first_frame_ = true; |
217 } | 217 } |
218 | 218 |
219 // Deliver the frame when it doesn't arrive too early. | 219 // Deliver the frame when it doesn't arrive too early. |
220 if (expected_next_frame_time_ <= current_time) { | 220 if (expected_next_frame_time_ <= current_time) { |
221 expected_next_frame_time_ += frame_interval_; | 221 expected_next_frame_time_ += frame_interval_; |
222 | 222 |
223 client_->OnIncomingCapturedFrame(reinterpret_cast<uint8*>(buffer), | 223 client_->OnIncomingCapturedFrame(reinterpret_cast<uint8*>(buffer), |
224 length, | 224 length, |
225 base::TimeTicks::Now(), | 225 capture_format_, |
226 rotation, | 226 rotation, |
227 capture_format_); | 227 base::TimeTicks::Now()); |
228 } | 228 } |
229 | 229 |
230 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); | 230 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); |
231 } | 231 } |
232 | 232 |
233 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { | 233 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { |
234 JNIEnv* env = AttachCurrentThread(); | 234 JNIEnv* env = AttachCurrentThread(); |
235 int current_capture_colorspace = | 235 int current_capture_colorspace = |
236 Java_VideoCapture_getColorspace(env, j_capture_.obj()); | 236 Java_VideoCapture_getColorspace(env, j_capture_.obj()); |
237 switch (current_capture_colorspace){ | 237 switch (current_capture_colorspace){ |
(...skipping 16 matching lines...) Expand all Loading... |
254 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { | 254 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { |
255 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; | 255 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; |
256 { | 256 { |
257 base::AutoLock lock(lock_); | 257 base::AutoLock lock(lock_); |
258 state_ = kError; | 258 state_ = kError; |
259 } | 259 } |
260 client_->OnError(); | 260 client_->OnError(); |
261 } | 261 } |
262 | 262 |
263 } // namespace media | 263 } // namespace media |
OLD | NEW |