Let threads opt in to having their stack traces printed

The video decoder thread is the pilot user.

For now this is an Android-only feature, since that's the only
platform we can print stack traces on.

Bug: webrtc:9987
Change-Id: Ie638c619673b5f159d91a32683fd787baf46479a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126222
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27127}
This commit is contained in:
Karl Wiberg
2019-03-12 18:01:51 +01:00
committed by Commit Bot
parent 9249fbf3a6
commit ab03638eb6
9 changed files with 153 additions and 1 deletions

View File

@ -527,12 +527,15 @@ public class PeerConnectionFactory {
/**
* Print the Java stack traces for the critical threads used by PeerConnectionFactory, namely;
* signaling thread, worker thread, and network thread. If printNativeStackTraces is true, also
* attempt to print the C++ stack traces for these threads.
* attempt to print the C++ stack traces for these (and some other) threads.
*/
public void printInternalStackTraces(boolean printNativeStackTraces) {
printStackTrace(signalingThread, printNativeStackTraces);
printStackTrace(workerThread, printNativeStackTraces);
printStackTrace(networkThread, printNativeStackTraces);
if (printNativeStackTraces) {
nativePrintStackTracesOfRegisteredThreads();
}
}
@CalledByNative
@ -592,4 +595,5 @@ public class PeerConnectionFactory {
private static native void nativeInjectLoggable(JNILogging jniLogging, int severity);
private static native void nativeDeleteLoggable();
private static native void nativePrintStackTrace(int tid);
private static native void nativePrintStackTracesOfRegisteredThreads();
}