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

Side by Side Diff: talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java

Issue 1321903002: CameraEnumerationAndroid: Make getSupportedFormats() an interface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Release camera in finally clause Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return; 213 return;
214 } 214 }
215 cameraThreadHandler.post(new Runnable() { 215 cameraThreadHandler.post(new Runnable() {
216 @Override public void run() { 216 @Override public void run() {
217 startPreviewOnCameraThread(width, height, framerate); 217 startPreviewOnCameraThread(width, height, framerate);
218 } 218 }
219 }); 219 });
220 } 220 }
221 221
222 public synchronized List<CaptureFormat> getSupportedFormats() { 222 public synchronized List<CaptureFormat> getSupportedFormats() {
223 return CameraEnumerationAndroid.supportedFormats.get(id); 223 return CameraEnumerationAndroid.getSupportedFormats(id);
224 } 224 }
225 225
226 // Return a list of timestamps for the frames that have been sent out, but not returned yet. 226 // Return a list of timestamps for the frames that have been sent out, but not returned yet.
227 // Useful for logging and testing. 227 // Useful for logging and testing.
228 public String pendingFramesTimeStamps() { 228 public String pendingFramesTimeStamps() {
229 return videoBuffers.pendingFramesTimeStamps(); 229 return videoBuffers.pendingFramesTimeStamps();
230 } 230 }
231 231
232 private VideoCapturerAndroid() { 232 private VideoCapturerAndroid() {
233 Log.d(TAG, "VideoCapturerAndroid"); 233 Log.d(TAG, "VideoCapturerAndroid");
234 } 234 }
235 235
236 // Called by native code. 236 // Called by native code.
237 // Enumerates resolution and frame rates for all cameras to be able to switch 237 // Initializes local variables for the camera named |deviceName|. If |deviceNa me| is empty, the
238 // cameras. Initializes local variables for the camera named |deviceName| and 238 // first available device is used in order to be compatible with the generic V ideoCapturer class.
239 // starts a thread to be used for capturing.
240 // If deviceName is empty, the first available device is used in order to be
241 // compatible with the generic VideoCapturer class.
242 synchronized boolean init(String deviceName) { 239 synchronized boolean init(String deviceName) {
243 Log.d(TAG, "init: " + deviceName); 240 Log.d(TAG, "init: " + deviceName);
244 if (deviceName == null || !CameraEnumerationAndroid.initStatics()) 241 if (deviceName == null)
245 return false; 242 return false;
246 243
247 boolean foundDevice = false; 244 boolean foundDevice = false;
248 if (deviceName.isEmpty()) { 245 if (deviceName.isEmpty()) {
249 this.id = 0; 246 this.id = 0;
250 foundDevice = true; 247 foundDevice = true;
251 } else { 248 } else {
252 for (int i = 0; i < Camera.getNumberOfCameras(); ++i) { 249 for (int i = 0; i < Camera.getNumberOfCameras(); ++i) {
253 String existing_device = CameraEnumerationAndroid.getDeviceName(i); 250 String existing_device = CameraEnumerationAndroid.getDeviceName(i);
254 if (existing_device != null && deviceName.equals(existing_device)) { 251 if (existing_device != null && deviceName.equals(existing_device)) {
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 } 750 }
754 751
755 private native void nativeCapturerStarted(long nativeCapturer, 752 private native void nativeCapturerStarted(long nativeCapturer,
756 boolean success); 753 boolean success);
757 private native void nativeOnFrameCaptured(long nativeCapturer, 754 private native void nativeOnFrameCaptured(long nativeCapturer,
758 byte[] data, int length, int width, int height, int rotation, long timeS tamp); 755 byte[] data, int length, int width, int height, int rotation, long timeS tamp);
759 private native void nativeOnOutputFormatRequest(long nativeCapturer, 756 private native void nativeOnOutputFormatRequest(long nativeCapturer,
760 int width, int height, int fps); 757 int width, int height, int fps);
761 } 758 }
762 } 759 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/CameraEnumerator.java ('k') | talk/app/webrtc/java/jni/classreferenceholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698