Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: media/video/capture/android/video_capture_device_android.cc

Issue 83793004: Implement IPCs and VideoCapture::Client interfaces for texture capture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 16cf3941 Rebase, comment. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
215 if (!got_first_frame_) { 215 if (!got_first_frame_) {
216 // Set aside one frame allowance for fluctuation. 216 // Set aside one frame allowance for fluctuation.
217 expected_next_frame_time_ = current_time - frame_interval_; 217 expected_next_frame_time_ = current_time - frame_interval_;
218 got_first_frame_ = true; 218 got_first_frame_ = true;
219 } 219 }
220 220
221 // Deliver the frame when it doesn't arrive too early. 221 // Deliver the frame when it doesn't arrive too early.
222 if (expected_next_frame_time_ <= current_time) { 222 if (expected_next_frame_time_ <= current_time) {
223 expected_next_frame_time_ += frame_interval_; 223 expected_next_frame_time_ += frame_interval_;
224 224
225 client_->OnIncomingCapturedFrame(reinterpret_cast<uint8*>(buffer), 225 client_->OnIncomingCapturedData(reinterpret_cast<uint8*>(buffer),
226 length, 226 length,
227 base::TimeTicks::Now(), 227 capture_format_,
228 rotation, 228 rotation,
229 capture_format_); 229 base::TimeTicks::Now());
230 } 230 }
231 231
232 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT); 232 env->ReleaseByteArrayElements(data, buffer, JNI_ABORT);
233 } 233 }
234 234
235 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { 235 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() {
236 JNIEnv* env = AttachCurrentThread(); 236 JNIEnv* env = AttachCurrentThread();
237 int current_capture_colorspace = 237 int current_capture_colorspace =
238 Java_VideoCapture_getColorspace(env, j_capture_.obj()); 238 Java_VideoCapture_getColorspace(env, j_capture_.obj());
239 switch (current_capture_colorspace) { 239 switch (current_capture_colorspace) {
(...skipping 10 matching lines...) Expand all
250 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { 250 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) {
251 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; 251 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason;
252 { 252 {
253 base::AutoLock lock(lock_); 253 base::AutoLock lock(lock_);
254 state_ = kError; 254 state_ = kError;
255 } 255 }
256 client_->OnError(reason); 256 client_->OnError(reason);
257 } 257 }
258 258
259 } // namespace media 259 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698