From b8a3a680f3e6720a8329bfaae571b09659aace52 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 09 四月 2025 19:47:55 +0800 Subject: [PATCH] 开发推流拉流工具类 --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgStartup.java | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgStartup.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgStartup.java index c8f80b4..0b8e5a4 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgStartup.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgStartup.java @@ -5,6 +5,8 @@ import io.netty.buffer.Unpooled; import lombok.Data; +import java.io.UnsupportedEncodingException; + /** * 实时音视频请求 * @@ -55,7 +57,12 @@ */ public byte[] encode() { ByteBuf byteBuf = Unpooled.buffer(130); - byte[] bytes1 = this.getVehicleNo().getBytes(); + byte[] bytes1 = new byte[0]; + try { + bytes1 = this.getVehicleNo().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } for (int i = 0; i < 21; i++) { if (i < bytes1.length) { byteBuf.writeByte(bytes1[i]); @@ -68,7 +75,12 @@ byteBuf.writeInt(this.getDataLength()); byteBuf.writeChar(this.getChannelId()); byteBuf.writeChar(this.getAvttemType()); - byte[] bytes2 = this.getAuthorizeCode().getBytes(); + byte[] bytes2 = new byte[0]; + try { + bytes2 = this.getAuthorizeCode().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } for (int i = 0; i < 64; i++) { if (i < bytes2.length) { byteBuf.writeByte(bytes2[i]); @@ -76,7 +88,12 @@ byteBuf.writeByte(0x00); } } - byte[] bytes3 = this.getGnssData().getBytes(); + byte[] bytes3 = new byte[0]; + try { + bytes3 = this.getGnssData().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } for (int i = 0; i < 36; i++) { if (i < bytes3.length) { byteBuf.writeByte(bytes3[i]); -- Gitblit v1.7.1