Mercurial > hg > Applications > TreeVNC
changeset 298:a9b8514a7c0e
clean code
author | oc |
---|---|
date | Thu, 15 Jan 2015 04:09:56 +0900 |
parents | ba5ab113fcca |
children | 3ede63861103 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/ReceiveSound.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 3 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/ReceiveSound.java Thu Jan 15 03:28:02 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/ReceiveSound.java Thu Jan 15 04:09:56 2015 +0900 @@ -45,7 +45,6 @@ while(!isStop) { try { this.socket.receive(packet); - System.out.println(packet); // skip rtp header. byteArrayInputStream = new ByteArrayInputStream(packet.getData(), 12, 160); ulawStream = new AudioInputStream(byteArrayInputStream, ulawFormat, 160);
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Thu Jan 15 03:28:02 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Thu Jan 15 04:09:56 2015 +0900 @@ -758,10 +758,9 @@ /** * Create send sound thread. */ - public void createShareSoundThread(TreeRFBProto rfb) throws SocketException, UnknownHostException { + public void createSendSoundThread(TreeRFBProto rfb) throws SocketException, UnknownHostException { SendSound sendSound; // DatagramSocket socket = new DatagramSocket(selectPort(ConnectionParams.DEFAULT_RTP_PORT), InetAddress.getLocalHost()); - if(rfb.isTreeManager()) { sendSound = new SendSound(socket, rfb); } else {
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jan 15 03:28:02 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Thu Jan 15 04:09:56 2015 +0900 @@ -35,7 +35,6 @@ import com.glavsoft.viewer.UiSettings; import com.glavsoft.viewer.Viewer; import com.glavsoft.viewer.ViewerInterface; -import com.glavsoft.viewer.swing.gui.ConnectionView; import com.glavsoft.viewer.swing.gui.OptionsDialog; import javax.swing.*; @@ -857,13 +856,14 @@ // show share sound dialog. boolean setShareSound = presenter.showShareSoundDialog(); - if (setShareSound) try { - shareSound(viewer.getRfb().isTreeManager(), context); - viewer.getRfb().createShareSoundThread(viewer.getRfb()); - } catch (SocketException e1) { - e1.printStackTrace(); - } catch (UnknownHostException e1) { - e1.printStackTrace(); + if (setShareSound) { + try { + shareSound(viewer.getRfb().isTreeManager(), context); + } catch (SocketException e1) { + e1.printStackTrace(); + } catch (UnknownHostException e1) { + e1.printStackTrace(); + } } if (viewer.getRfb().isTreeManager()) { @@ -871,7 +871,6 @@ return; } String adr = viewer.getRfb().getMyAddress(); - context.sendMessage(new ReadyShareSound()); context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId(), (int) rectangles.get(leftScreenNumber).getWidth(), (int) rectangles.get(leftScreenNumber).getHeight())); } }); @@ -929,10 +928,11 @@ } private void shareSound(boolean isTreeManager, ProtocolContext context) throws SocketException, UnknownHostException { - if (isTreeManager) { - viewer.getRfb().createShareSoundThread(viewer.getRfb()); + viewer.getRfb().createSendSoundThread(viewer.getRfb()); + if (!isTreeManager) { + context.sendMessage(new ReadyShareSound()); + return; } - context.sendMessage(new ReadyShareSound()); } private void sendCtrlAltDel(ProtocolContext context) {