Clear queue while shutting down

Signed-off-by: Leo Ma <begeekmyfriend@gmail.com>
camera2
Leo Ma 9 years ago
parent fd7eb0566d
commit e082e3ba2e

@ -393,6 +393,7 @@ public class RtmpConnection implements RtmpPublisher, PacketRxHandler {
}
// shutdown handleRxPacketLoop
rxPacketQueue.clear();
active = false;
synchronized (rxPacketLock) {
rxPacketLock.notify();
@ -454,4 +455,4 @@ public class RtmpConnection implements RtmpPublisher, PacketRxHandler {
public final String getRtmpUrl() {
return rtmpUrl;
}
}
}

@ -84,7 +84,7 @@ public class WriteThread extends Thread {
/** Transmit the specified RTMP packet (thread-safe) */
public void send(RtmpPacket rtmpPacket) {
if (rtmpPacket != null) {
writeQueue.offer(rtmpPacket);
writeQueue.add(rtmpPacket);
}
synchronized (txPacketLock) {
txPacketLock.notify();
@ -93,6 +93,7 @@ public class WriteThread extends Thread {
public void shutdown() {
Log.d(TAG, "Stopping");
writeQueue.clear();
active = false;
synchronized (txPacketLock) {
txPacketLock.notify();

Loading…
Cancel
Save