Skip to content

Commit bed7bc5

Browse files
committed
still...
1 parent 439a51d commit bed7bc5

8 files changed

Lines changed: 11 additions & 3 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mod_name=Channel
3030
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3131
mod_license=GNU GPL 3.0
3232
# The mod version. See https://semver.org/
33-
mod_version=26.1.2-15+alpha
33+
mod_version=26.1.2-16+alpha
3434
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
3535
# This should match the base package used for the mod sources.
3636
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/cn/ussshenzhou/channel/audio/client/receive/AudioReceiveHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private static void handleInternal(AudioPacket2C packet, Level level) throws Exc
7474
}
7575
var earPos = AudioHelper.getEarPos();
7676
var decoded = OpusManager.decode(packet.opus, packet.from);
77+
LogUtils.getLogger().warn("{}",decoded.length);
7778
if (Minecraft.getInstance().player != null && !Minecraft.getInstance().player.getUUID().equals(packet.from) && earPos.distanceToSqr(x, y, z) <= 64 * 64) {
7879
// direct talking sound always apply
7980
var audio = getDirectAudioAndCheckSampleRate(packet.from, 48000);

src/main/java/cn/ussshenzhou/channel/audio/client/send/MicReader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public static void init() {
3737
slidingWindow = new WebRTCHelper.SimpleSlidingBooleanWindow(ModConstant.VAD_SMOOTH_WINDOW_LENGTH_MS / frameLength);
3838
}
3939

40-
@Deprecated
4140
public static synchronized void frameLengthChange() {
4241
keepReading.cancel(false);
4342
frameLength = ChannelClientConfig.get().frameLengthMs;

src/main/java/cn/ussshenzhou/channel/gui/TransmitConfigPanel.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.ussshenzhou.channel.gui;
22

33
import cn.ussshenzhou.channel.audio.OpusManager;
4+
import cn.ussshenzhou.channel.audio.client.send.MicReader;
45
import cn.ussshenzhou.channel.config.ChannelClientConfig;
56
import cn.ussshenzhou.channel.subspace.client.SubspaceConnection;
67
import cn.ussshenzhou.channel.util.ModConstant;
@@ -36,7 +37,10 @@ public TransmitConfigPanel() {
3637
addOptionCycleButtonInit(
3738
Component.translatable("channel.config.net.length"),
3839
Stream.concat(ModConstant.USABLE_FRAME_LENGTH.stream(), Stream.of(cfg.frameLengthMs)).distinct().collect(Collectors.toList()),
39-
length -> _ -> ChannelClientConfig.write(c -> c.frameLengthMs = length),
40+
length -> _ -> {
41+
ChannelClientConfig.write(c -> c.frameLengthMs = length);
42+
MicReader.frameLengthChange();
43+
},
4044
entry -> entry.getContent() == cfg.frameLengthMs
4145
).getB().setTooltip(Tooltip.create(Component.translatable("channel.config.net.length.tooltip")));
4246
var netSampleRate = addOptionCycleButtonInit(

src/main/java/cn/ussshenzhou/channel/subspace/client/SubspaceConnection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private static void connectTcp(SubspaceInitPacket packet) {
183183
new Bootstrap()
184184
.group(EVENT_LOOP_GROUP)
185185
.channel(NioSocketChannel.class)
186+
.option(ChannelOption.TCP_NODELAY, true)
186187
.handler(new ChannelInitializer<SocketChannel>() {
187188
@Override
188189
protected void initChannel(SocketChannel ch) {

src/main/java/cn/ussshenzhou/channel/subspace/server/SubspaceConnection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static void connect() {
5454
new Bootstrap()
5555
.group(EVENT_LOOP_GROUP)
5656
.channel(NioSocketChannel.class)
57+
.option(ChannelOption.TCP_NODELAY, true)
5758
.handler(new ChannelInitializer<SocketChannel>() {
5859
@Override
5960
protected void initChannel(SocketChannel ch) {

subspace/src/network/ClientTcpConnection.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ namespace subspace {
4646
}
4747

4848
void ClientTcpConnection::start() {
49+
socket.set_option(asio::ip::tcp::no_delay(true));
4950
remoteAddress = socket.remote_endpoint().address().to_string() + ":" + std::to_string(socket.remote_endpoint().port());
5051
spdlog::info("Client connecting from {}", getRemoteAddress());
5152
handshakeTimer.expires_after(std::chrono::seconds(5));

subspace/src/network/ServerConnection.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace subspace {
99
BaseConnection(CryptHelper::NULL_ENCODE_DECODE, CryptHelper::AES_GCM_DECODE), socket(std::move(socket)), handshakeTimer(this->socket.get_executor()) {}
1010

1111
void ServerConnection::start() {
12+
socket.set_option(asio::ip::tcp::no_delay(true));
1213
remoteAddress = socket.remote_endpoint().address().to_string() + ":" + std::to_string(socket.remote_endpoint().port());
1314
spdlog::info("Minecraft Server connecting, from {}", getRemoteAddress());
1415
handshakeTimer.expires_from_now(std::chrono::seconds(3));

0 commit comments

Comments
 (0)