kopia lustrzana https://github.com/sh123/codec2_talkie
Update settings screenshot
rodzic
d745b4b963
commit
23d4beb14a
|
@ -1,6 +1,8 @@
|
||||||
package com.radio.codec2talkie.protocol;
|
package com.radio.codec2talkie.protocol;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
|
import java.nio.BufferUnderflowException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
@ -9,7 +11,7 @@ public class KissParrot extends Kiss {
|
||||||
|
|
||||||
private final int BUFFER_SIZE = 3200 * 60 * 5;
|
private final int BUFFER_SIZE = 3200 * 60 * 5;
|
||||||
|
|
||||||
private final int PLAYBACK_DELAY_MS = 2000;
|
private final int PLAYBACK_DELAY_MS = 1000;
|
||||||
|
|
||||||
private final ByteBuffer _buffer;
|
private final ByteBuffer _buffer;
|
||||||
|
|
||||||
|
@ -24,8 +26,10 @@ public class KissParrot extends Kiss {
|
||||||
if (_buffer.position() > 0) {
|
if (_buffer.position() > 0) {
|
||||||
_buffer.flip();
|
_buffer.flip();
|
||||||
try {
|
try {
|
||||||
_transport.write(_buffer.array());
|
byte[] b = new byte[_buffer.remaining()];
|
||||||
} catch (IOException e) {
|
_buffer.get(b);
|
||||||
|
_transport.write(b);
|
||||||
|
} catch (IOException | BufferUnderflowException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
_buffer.clear();
|
_buffer.clear();
|
||||||
|
@ -41,9 +45,12 @@ public class KissParrot extends Kiss {
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException ignored) {}
|
} catch (IllegalStateException ignored) {}
|
||||||
|
|
||||||
_buffer.put(data);
|
try {
|
||||||
super.receiveKissData(data, callback);
|
_buffer.put(data);
|
||||||
|
super.receiveKissData(data, callback);
|
||||||
|
} catch (BufferOverflowException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
_playbackTimer = new Timer();
|
_playbackTimer = new Timer();
|
||||||
_playbackTimer.schedule(new TimerTask() {
|
_playbackTimer.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Plik binarny nie jest wyświetlany.
Przed Szerokość: | Wysokość: | Rozmiar: 34 KiB Po Szerokość: | Wysokość: | Rozmiar: 51 KiB |
Ładowanie…
Reference in New Issue