| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if (!got_first_frame_) { | 250 if (!got_first_frame_) { |
| 251 // Set aside one frame allowance for fluctuation. | 251 // Set aside one frame allowance for fluctuation. |
| 252 expected_next_frame_time_ = current_time - frame_interval_; | 252 expected_next_frame_time_ = current_time - frame_interval_; |
| 253 got_first_frame_ = true; | 253 got_first_frame_ = true; |
| 254 } | 254 } |
| 255 | 255 |
| 256 // Deliver the frame when it doesn't arrive too early. | 256 // Deliver the frame when it doesn't arrive too early. |
| 257 if (expected_next_frame_time_ <= current_time) { | 257 if (expected_next_frame_time_ <= current_time) { |
| 258 expected_next_frame_time_ += frame_interval_; | 258 expected_next_frame_time_ += frame_interval_; |
| 259 | 259 |
| 260 client_->OnIncomingCapturedFrame(reinterpret_cast<uint8*>(buffer), | 260 client_->OnIncomingCapturedData(reinterpret_cast<uint8*>(buffer), |
| 261 length, | 261 length, |
| 262 base::TimeTicks::Now(), | 262 capture_format_, |
| 263 rotation, | 263 rotation, |
| 264 capture_format_); | 264 base::TimeTicks::Now()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); | 267 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); |
| 268 } | 268 } |
| 269 | 269 |
| 270 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { | 270 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { |
| 271 JNIEnv* env = AttachCurrentThread(); | 271 JNIEnv* env = AttachCurrentThread(); |
| 272 int current_capture_colorspace = | 272 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) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 285 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { | 285 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { |
| 286 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; | 286 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; |
| 287 { | 287 { |
| 288 base::AutoLock lock(lock_); | 288 base::AutoLock lock(lock_); |
| 289 state_ = kError; | 289 state_ = kError; |
| 290 } | 290 } |
| 291 client_->OnError(reason); | 291 client_->OnError(reason); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace media | 294 } // namespace media |
| OLD | NEW |