Fix shutdown bug

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

@ -301,6 +301,7 @@ public class RtmpConnection implements RtmpPublisher {
@Override @Override
public void shutdown() { public void shutdown() {
if (socket != null) {
try { try {
// It will raise EOFException in handleRxPacketThread // It will raise EOFException in handleRxPacketThread
socket.shutdownInput(); socket.shutdownInput();
@ -322,18 +323,17 @@ public class RtmpConnection implements RtmpPublisher {
} }
// shutdown socket as well as its input and output stream // shutdown socket as well as its input and output stream
if (socket != null) {
try { try {
socket.close(); socket.close();
Log.d(TAG, "socket closed"); Log.d(TAG, "socket closed");
} catch (IOException ex) { } catch (IOException ex) {
Log.e(TAG, "shutdown(): failed to close socket", ex); Log.e(TAG, "shutdown(): failed to close socket", ex);
} }
}
reset(); reset();
mHandler.onRtmpDisconnected("disconnected"); mHandler.onRtmpDisconnected("disconnected");
} }
}
private void reset() { private void reset() {
connected = false; connected = false;

Loading…
Cancel
Save