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:
@ -776,6 +776,7 @@ if (is_android) {
|
||||
"../../rtc_base:rtc_base",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"../../rtc_base:rtc_task_queue",
|
||||
"../../rtc_base/system:thread_registry",
|
||||
"../../system_wrappers:field_trial",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
// The user may pass in a nullptr.
|
||||
#include "modules/audio_processing/include/audio_processing.h" // nogncheck
|
||||
#include "rtc_base/event_tracer.h"
|
||||
#include "rtc_base/system/thread_registry.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "sdk/android/generated_peerconnection_jni/jni/PeerConnectionFactory_jni.h"
|
||||
#include "sdk/android/native_api/jni/java_types.h"
|
||||
@ -520,5 +521,10 @@ static void JNI_PeerConnectionFactory_PrintStackTrace(JNIEnv* env, jint tid) {
|
||||
RTC_LOG(LS_WARNING) << StackTraceToString(GetStackTrace(tid));
|
||||
}
|
||||
|
||||
static void JNI_PeerConnectionFactory_PrintStackTracesOfRegisteredThreads(
|
||||
JNIEnv* env) {
|
||||
PrintStackTracesOfRegisteredThreads();
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user