OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 package org.webrtc; | 28 package org.webrtc; |
29 | 29 |
30 import android.content.Context; | 30 import android.content.Context; |
31 import android.hardware.Camera; | 31 import android.hardware.Camera; |
32 import android.hardware.Camera.PreviewCallback; | 32 import android.hardware.Camera.PreviewCallback; |
33 import android.opengl.EGL14; | 33 import android.opengl.EGL14; |
34 import android.opengl.EGLContext; | 34 import android.opengl.EGLContext; |
35 import android.os.Handler; | 35 import android.os.Handler; |
36 import android.os.HandlerThread; | 36 import android.os.HandlerThread; |
37 import android.os.SystemClock; | 37 import android.os.SystemClock; |
38 import android.text.StaticLayout; | |
39 import android.view.Surface; | 38 import android.view.Surface; |
40 import android.view.WindowManager; | 39 import android.view.WindowManager; |
41 | 40 |
42 import org.json.JSONException; | 41 import org.json.JSONException; |
43 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; | 42 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; |
44 import org.webrtc.Logging; | 43 import org.webrtc.Logging; |
45 | 44 |
46 import java.io.IOException; | 45 import java.io.IOException; |
47 import java.nio.ByteBuffer; | 46 import java.nio.ByteBuffer; |
48 import java.util.ArrayList; | 47 import java.util.ArrayList; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (cameraId == -1) { | 209 if (cameraId == -1) { |
211 return null; | 210 return null; |
212 } | 211 } |
213 | 212 |
214 final VideoCapturerAndroid capturer = new VideoCapturerAndroid(cameraId, err
orHandler, | 213 final VideoCapturerAndroid capturer = new VideoCapturerAndroid(cameraId, err
orHandler, |
215 sharedContext); | 214 sharedContext); |
216 capturer.setNativeCapturer(nativeCreateVideoCapturer(capturer)); | 215 capturer.setNativeCapturer(nativeCreateVideoCapturer(capturer)); |
217 return capturer; | 216 return capturer; |
218 } | 217 } |
219 | 218 |
| 219 public void printStackTrace() { |
| 220 if (cameraThread != null) { |
| 221 StackTraceElement[] cameraStackTraces = cameraThread.getStackTrace(); |
| 222 if (cameraStackTraces.length > 0) { |
| 223 Logging.d(TAG, "VideoCapturerAndroid stacks trace:"); |
| 224 for (StackTraceElement stackTrace : cameraStackTraces) { |
| 225 Logging.d(TAG, stackTrace.toString()); |
| 226 } |
| 227 } |
| 228 } |
| 229 } |
| 230 |
220 // Switch camera to the next valid camera id. This can only be called while | 231 // Switch camera to the next valid camera id. This can only be called while |
221 // the camera is running. | 232 // the camera is running. |
222 public void switchCamera(final CameraSwitchHandler handler) { | 233 public void switchCamera(final CameraSwitchHandler handler) { |
223 if (Camera.getNumberOfCameras() < 2) { | 234 if (Camera.getNumberOfCameras() < 2) { |
224 if (handler != null) { | 235 if (handler != null) { |
225 handler.onCameraSwitchError("No camera to switch to."); | 236 handler.onCameraSwitchError("No camera to switch to."); |
226 } | 237 } |
227 return; | 238 return; |
228 } | 239 } |
229 synchronized (pendingCameraSwitchLock) { | 240 synchronized (pendingCameraSwitchLock) { |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 private native void nativeOnByteBufferFrameCaptured(long nativeCapturer, | 865 private native void nativeOnByteBufferFrameCaptured(long nativeCapturer, |
855 byte[] data, int length, int width, int height, int rotation, long timeS
tamp); | 866 byte[] data, int length, int width, int height, int rotation, long timeS
tamp); |
856 private native void nativeOnTextureFrameCaptured(long nativeCapturer, int wi
dth, int height, | 867 private native void nativeOnTextureFrameCaptured(long nativeCapturer, int wi
dth, int height, |
857 int oesTextureId, float[] transformMatrix, long timestamp); | 868 int oesTextureId, float[] transformMatrix, long timestamp); |
858 private native void nativeOnOutputFormatRequest(long nativeCapturer, | 869 private native void nativeOnOutputFormatRequest(long nativeCapturer, |
859 int width, int height, int framerate); | 870 int width, int height, int framerate); |
860 } | 871 } |
861 | 872 |
862 private static native long nativeCreateVideoCapturer(VideoCapturerAndroid vide
oCapturer); | 873 private static native long nativeCreateVideoCapturer(VideoCapturerAndroid vide
oCapturer); |
863 } | 874 } |
OLD | NEW |