yonge 3 vuotta sitten
vanhempi
commit
a726de9ef3

+ 2 - 2
audio-analysis/src/main/java/com/yonge/netty/dto/UserChannelContext.java

@@ -343,11 +343,11 @@ public class UserChannelContext {
 		
 		double durationTime = 1000 * (samples.length * 2) / audioFormat.getSampleRate() / (audioFormat.getSampleSizeInBits() / 8);
 		
-		receivedTime += durationTime;
+		/*receivedTime += durationTime;
 		
 		if(receivedTime < offsetMS){
 			return;
-		}
+		}*/
 		
 		playTime += durationTime;
 		

+ 3 - 1
audio-analysis/src/main/java/com/yonge/netty/server/service/AudioCompareHandler.java

@@ -79,7 +79,7 @@ public class AudioCompareHandler implements MessageHandler {
 	/**
 	 * @describe 采样大小
 	 */
-	private int bufferSize = 1024 * 4;
+	private int bufferSize = 1024 * 2;
 
 	private boolean signed = true;
 
@@ -298,6 +298,8 @@ public class AudioCompareHandler implements MessageHandler {
 			if(totalLength > beatByteLength){
 				channelContext.setChannelBufferBytes(ArrayUtil.extractByte(channelContext.getChannelBufferBytes(), beatByteLength, totalLength - 1));
 				channelContext.setOffsetMS(0);
+				
+				LOGGER.info("--------Length:{}  Times:{}--------", waveFileProcessor.getFile().length() - channelContext.getChannelBufferBytes().length,(waveFileProcessor.getFile().length() - channelContext.getChannelBufferBytes().length) * 1000 /WaveformWriter.SAMPLE_RATE/2);
 			}else{
 				return false;
 			}