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

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

Issue 98773003: Add performance tracing event to VideoCaptureDeviceAndroid::OnFrameAvailable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "base/debug/trace_event.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "jni/VideoCapture_jni.h" 15 #include "jni/VideoCapture_jni.h"
15 #include "media/base/video_util.h" 16 #include "media/base/video_util.h"
16 17
17 using base::android::AttachCurrentThread; 18 using base::android::AttachCurrentThread;
18 using base::android::CheckException; 19 using base::android::CheckException;
19 using base::android::GetClass; 20 using base::android::GetClass;
20 using base::android::MethodID; 21 using base::android::MethodID;
21 using base::android::JavaRef; 22 using base::android::JavaRef;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 Java_VideoCapture_deallocate(env, j_capture_.obj()); 191 Java_VideoCapture_deallocate(env, j_capture_.obj());
191 } 192 }
192 193
193 void VideoCaptureDeviceAndroid::OnFrameAvailable( 194 void VideoCaptureDeviceAndroid::OnFrameAvailable(
194 JNIEnv* env, 195 JNIEnv* env,
195 jobject obj, 196 jobject obj,
196 jbyteArray data, 197 jbyteArray data,
197 jint length, 198 jint length,
198 jint rotation) { 199 jint rotation) {
200 TRACE_EVENT0("video", "VideoCaptureDeviceAndroid::OnFrameAvailable");
tommi (sloooow) - chröme 2013/12/18 14:01:33 Since Android is very sensitive to performance I h
mcasas 2013/12/18 14:32:36 Well, nothing comes for free. From the docs: " Tr
tommi (sloooow) - chröme 2013/12/18 15:14:33 That's good enough for me. I know how this is imp
199 DVLOG(3) << "VideoCaptureDeviceAndroid::OnFrameAvailable: length =" << length; 201 DVLOG(3) << "VideoCaptureDeviceAndroid::OnFrameAvailable: length =" << length;
200 202
201 base::AutoLock lock(lock_); 203 base::AutoLock lock(lock_);
202 if (state_ != kCapturing || !client_.get()) 204 if (state_ != kCapturing || !client_.get())
203 return; 205 return;
204 206
205 jbyte* buffer = env->GetByteArrayElements(data, NULL); 207 jbyte* buffer = env->GetByteArrayElements(data, NULL);
206 if (!buffer) { 208 if (!buffer) {
207 LOG(ERROR) << "VideoCaptureDeviceAndroid::OnFrameAvailable: " 209 LOG(ERROR) << "VideoCaptureDeviceAndroid::OnFrameAvailable: "
208 "failed to GetByteArrayElements"; 210 "failed to GetByteArrayElements";
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) { 256 void VideoCaptureDeviceAndroid::SetErrorState(const std::string& reason) {
255 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason; 257 LOG(ERROR) << "VideoCaptureDeviceAndroid::SetErrorState: " << reason;
256 { 258 {
257 base::AutoLock lock(lock_); 259 base::AutoLock lock(lock_);
258 state_ = kError; 260 state_ = kError;
259 } 261 }
260 client_->OnError(); 262 client_->OnError();
261 } 263 }
262 264
263 } // namespace media 265 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698