Name Java threads

Give a user-friendly name to Java threads created by the server.
This commit is contained in:
Romain Vimont 2023-06-09 22:24:32 +02:00
parent a3cdf1a6b8
commit fdbc9397a7
6 changed files with 9 additions and 9 deletions

View file

@ -134,7 +134,7 @@ public final class AudioEncoder implements AsyncProcessor {
Ln.d("Audio encoder stopped"); Ln.d("Audio encoder stopped");
listener.onTerminated(fatalError); listener.onTerminated(fatalError);
} }
}); }, "audio-encoder");
thread.start(); thread.start();
} }
@ -183,7 +183,7 @@ public final class AudioEncoder implements AsyncProcessor {
Codec codec = streamer.getCodec(); Codec codec = streamer.getCodec();
mediaCodec = createMediaCodec(codec, encoderName); mediaCodec = createMediaCodec(codec, encoderName);
mediaCodecThread = new HandlerThread("AudioEncoder"); mediaCodecThread = new HandlerThread("media-codec");
mediaCodecThread.start(); mediaCodecThread.start();
MediaFormat format = createFormat(codec.getMimeType(), bitRate, codecOptions); MediaFormat format = createFormat(codec.getMimeType(), bitRate, codecOptions);
@ -201,7 +201,7 @@ public final class AudioEncoder implements AsyncProcessor {
} finally { } finally {
end(); end();
} }
}); }, "audio-in");
outputThread = new Thread(() -> { outputThread = new Thread(() -> {
try { try {
@ -216,7 +216,7 @@ public final class AudioEncoder implements AsyncProcessor {
} finally { } finally {
end(); end();
} }
}); }, "audio-out");
mediaCodec.start(); mediaCodec.start();
mediaCodecStarted = true; mediaCodecStarted = true;

View file

@ -69,7 +69,7 @@ public final class AudioRawRecorder implements AsyncProcessor {
Ln.d("Audio recorder stopped"); Ln.d("Audio recorder stopped");
listener.onTerminated(fatalError); listener.onTerminated(fatalError);
} }
}); }, "audio-raw");
thread.start(); thread.start();
} }

View file

@ -95,7 +95,7 @@ public class Controller implements AsyncProcessor {
Ln.d("Controller stopped"); Ln.d("Controller stopped");
listener.onTerminated(true); listener.onTerminated(true);
} }
}); }, "control-recv");
thread.start(); thread.start();
sender.start(); sender.start();
} }

View file

@ -60,7 +60,7 @@ public final class DeviceMessageSender {
} finally { } finally {
Ln.d("Device message sender stopped"); Ln.d("Device message sender stopped");
} }
}); }, "control-send");
thread.start(); thread.start();
} }

View file

@ -299,7 +299,7 @@ public class ScreenEncoder implements Device.RotationListener, Device.FoldListen
Ln.d("Screen streaming stopped"); Ln.d("Screen streaming stopped");
listener.onTerminated(true); listener.onTerminated(true);
} }
}); }, "video");
thread.start(); thread.start();
} }

View file

@ -185,7 +185,7 @@ public final class Server {
} }
private static Thread startInitThread(final Options options) { private static Thread startInitThread(final Options options) {
Thread thread = new Thread(() -> initAndCleanUp(options)); Thread thread = new Thread(() -> initAndCleanUp(options), "init-cleanup");
thread.start(); thread.start();
return thread; return thread;
} }