Browse Source

经纬重置 重写

jianghouwei 6 years ago
parent
commit
f9df3e063b

+ 4 - 4
src/main/java/com/tidecloud/dataacceptance/service/DelimiterJingWeiFrameDecoder.java

@@ -67,7 +67,7 @@ public class DelimiterJingWeiFrameDecoder extends ByteToMessageDecoder {
                 }
             }
             in.resetReaderIndex();
-           // in.readerIndex(beginIndex);
+            // in.readerIndex(beginIndex);
             // 标记数据
             byte[] req = new byte[cutLength + 1];
             in.readBytes(req);
@@ -80,13 +80,13 @@ public class DelimiterJingWeiFrameDecoder extends ByteToMessageDecoder {
                 return;
             }
             // 语音数据
-            in.readerIndex(beginIndex);
-            int readLength = cutLength + 1 + length + 1;
+//            in.readerIndex(beginIndex);
 //            ByteBuf otherByteBufRef = in.readBytes(readLength);
 //            out.add(otherByteBufRef);
+            in.resetReaderIndex();
+            int readLength = cutLength + 1 + length + 1;
             Object decoded = decode(readLength, ctx, in);
             out.add(decoded);
-//            in.retain();
         } else {// 是其他包
             Object decoded = decode(ctx, in);
             if (decoded != null) {