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

Side by Side Diff: talk/app/webrtc/java/src/org/webrtc/PeerConnectionFactory.java

Issue 1395693002: Add option to print peer connection factory Java stack traces. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add native callback API Created 5 years, 2 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
« no previous file with comments | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | 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 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 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 21 matching lines...) Expand all
32 32
33 /** 33 /**
34 * Java wrapper for a C++ PeerConnectionFactoryInterface. Main entry point to 34 * Java wrapper for a C++ PeerConnectionFactoryInterface. Main entry point to
35 * the PeerConnection API for clients. 35 * the PeerConnection API for clients.
36 */ 36 */
37 public class PeerConnectionFactory { 37 public class PeerConnectionFactory {
38 static { 38 static {
39 System.loadLibrary("jingle_peerconnection_so"); 39 System.loadLibrary("jingle_peerconnection_so");
40 } 40 }
41 41
42 private static final String TAG = "PeerConnectionFactory";
42 private final long nativeFactory; 43 private final long nativeFactory;
44 private static Thread workerThread;
45 private static Thread signalingThread;
43 46
44 public static class Options { 47 public static class Options {
45 // Keep in sync with webrtc/base/network.h! 48 // Keep in sync with webrtc/base/network.h!
46 static final int ADAPTER_TYPE_UNKNOWN = 0; 49 static final int ADAPTER_TYPE_UNKNOWN = 0;
47 static final int ADAPTER_TYPE_ETHERNET = 1 << 0; 50 static final int ADAPTER_TYPE_ETHERNET = 1 << 0;
48 static final int ADAPTER_TYPE_WIFI = 1 << 1; 51 static final int ADAPTER_TYPE_WIFI = 1 << 1;
49 static final int ADAPTER_TYPE_CELLULAR = 1 << 2; 52 static final int ADAPTER_TYPE_CELLULAR = 1 << 2;
50 static final int ADAPTER_TYPE_VPN = 1 << 3; 53 static final int ADAPTER_TYPE_VPN = 1 << 3;
51 static final int ADAPTER_TYPE_LOOPBACK = 1 << 4; 54 static final int ADAPTER_TYPE_LOOPBACK = 1 << 4;
52 55
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 132
130 public void setOptions(Options options) { 133 public void setOptions(Options options) {
131 nativeSetOptions(nativeFactory, options); 134 nativeSetOptions(nativeFactory, options);
132 } 135 }
133 136
134 public void setVideoHwAccelerationOptions(Object renderEGLContext) { 137 public void setVideoHwAccelerationOptions(Object renderEGLContext) {
135 nativeSetVideoHwAccelerationOptions(nativeFactory, renderEGLContext); 138 nativeSetVideoHwAccelerationOptions(nativeFactory, renderEGLContext);
136 } 139 }
137 140
138 public void dispose() { 141 public void dispose() {
139 freeFactory(nativeFactory); 142 nativeFreeFactory(nativeFactory);
143 signalingThread = null;
144 workerThread = null;
145 }
146
147 public void threadsCallbacks() {
148 nativeThreadsCallbacks(nativeFactory);
149 }
150
151 public static void printStackTraces() {
152 if (workerThread != null) {
153 Logging.d(TAG, "Worker thread stacks trace:");
154 for (StackTraceElement stackTrace : workerThread.getStackTrace()) {
155 Logging.d(TAG, stackTrace.toString());
156 }
157 }
158 if (signalingThread != null) {
159 Logging.d(TAG, "Signaling thread stacks trace:");
160 for (StackTraceElement stackTrace : signalingThread.getStackTrace()) {
161 Logging.d(TAG, stackTrace.toString());
162 }
163 }
164 }
165
166 private static void onWorkerThreadReady() {
167 workerThread = Thread.currentThread();
168 Logging.d(TAG, "onWorkerThreadReady");
169 }
170
171 private static void onSignalingThreadReady() {
172 signalingThread = Thread.currentThread();
173 Logging.d(TAG, "onSignalingThreadReady");
140 } 174 }
141 175
142 private static native long nativeCreatePeerConnectionFactory(); 176 private static native long nativeCreatePeerConnectionFactory();
143 177
144 private static native long nativeCreateObserver( 178 private static native long nativeCreateObserver(
145 PeerConnection.Observer observer); 179 PeerConnection.Observer observer);
146 180
147 private static native long nativeCreatePeerConnection( 181 private static native long nativeCreatePeerConnection(
148 long nativeFactory, PeerConnection.RTCConfiguration rtcConfig, 182 long nativeFactory, PeerConnection.RTCConfiguration rtcConfig,
149 MediaConstraints constraints, long nativeObserver); 183 MediaConstraints constraints, long nativeObserver);
(...skipping 12 matching lines...) Expand all
162 long nativeFactory, MediaConstraints constraints); 196 long nativeFactory, MediaConstraints constraints);
163 197
164 private static native long nativeCreateAudioTrack( 198 private static native long nativeCreateAudioTrack(
165 long nativeFactory, String id, long nativeSource); 199 long nativeFactory, String id, long nativeSource);
166 200
167 public native void nativeSetOptions(long nativeFactory, Options options); 201 public native void nativeSetOptions(long nativeFactory, Options options);
168 202
169 private static native void nativeSetVideoHwAccelerationOptions( 203 private static native void nativeSetVideoHwAccelerationOptions(
170 long nativeFactory, Object renderEGLContext); 204 long nativeFactory, Object renderEGLContext);
171 205
172 private static native void freeFactory(long nativeFactory); 206 private static native void nativeThreadsCallbacks(long nativeFactory);
207
208 private static native void nativeFreeFactory(long nativeFactory);
173 } 209 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698