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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "jni/VideoCapture_jni.h" | 10 #include "jni/VideoCapture_jni.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (!got_first_frame_) { | 154 if (!got_first_frame_) { |
155 // Set aside one frame allowance for fluctuation. | 155 // Set aside one frame allowance for fluctuation. |
156 expected_next_frame_time_ = current_time - frame_interval_; | 156 expected_next_frame_time_ = current_time - frame_interval_; |
157 got_first_frame_ = true; | 157 got_first_frame_ = true; |
158 } | 158 } |
159 | 159 |
160 // Deliver the frame when it doesn't arrive too early. | 160 // Deliver the frame when it doesn't arrive too early. |
161 if (expected_next_frame_time_ <= current_time) { | 161 if (expected_next_frame_time_ <= current_time) { |
162 expected_next_frame_time_ += frame_interval_; | 162 expected_next_frame_time_ += frame_interval_; |
163 | 163 |
164 client_->OnIncomingCapturedData(reinterpret_cast<uint8*>(buffer), length, | 164 client_->OnIncomingCapturedData(reinterpret_cast<uint8_t*>(buffer), length, |
165 capture_format_, rotation, | 165 capture_format_, rotation, |
166 base::TimeTicks::Now()); | 166 base::TimeTicks::Now()); |
167 } | 167 } |
168 | 168 |
169 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); | 169 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); |
170 } | 170 } |
171 | 171 |
172 void VideoCaptureDeviceAndroid::OnError(JNIEnv* env, | 172 void VideoCaptureDeviceAndroid::OnError(JNIEnv* env, |
173 const JavaParamRef<jobject>& obj, | 173 const JavaParamRef<jobject>& obj, |
174 const JavaParamRef<jstring>& message) { | 174 const JavaParamRef<jstring>& message) { |
(...skipping 22 matching lines...) Expand all Loading... |
197 const tracked_objects::Location& from_here, | 197 const tracked_objects::Location& from_here, |
198 const std::string& reason) { | 198 const std::string& reason) { |
199 { | 199 { |
200 base::AutoLock lock(lock_); | 200 base::AutoLock lock(lock_); |
201 state_ = kError; | 201 state_ = kError; |
202 } | 202 } |
203 client_->OnError(from_here, reason); | 203 client_->OnError(from_here, reason); |
204 } | 204 } |
205 | 205 |
206 } // namespace media | 206 } // namespace media |
OLD | NEW |