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

View file

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

View file

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

View file

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

View file

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

View file

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