diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/ScreenShareSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/ScreenShareSession.java index c8be51d6a..6e369e16b 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/ScreenShareSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/ScreenShareSession.java @@ -142,14 +142,18 @@ public class ScreenShareSession extends JingleMediaSession { * Stops transmission and for NAT Traversal reasons stop receiving also. */ public void stopTrasmit() { - + if(transmitter!=null){ + transmitter.stop(); + } } /** * For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf */ public void stopReceive() { - // Do nothing + if(receiver!=null){ + receiver.stop(); + } } /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/api/ImageTransmitter.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/api/ImageTransmitter.java index 4b29628a8..b7884a58e 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/api/ImageTransmitter.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/sshare/api/ImageTransmitter.java @@ -100,28 +100,34 @@ public class ImageTransmitter implements Runnable { if (baos != null) { - Thread.sleep(1); - - baos.write(i); - baos.write(j); - - byte[] bytesOut = baos.toByteArray(); - - if (bytesOut.length > 1000) - System.err.println(bytesOut.length); - - p.setData(bytesOut); - p.setAddress(remoteHost); - p.setPort(remotePort); - try { - socket.send(p); - } - catch (IOException e) { - e.printStackTrace(); - } - tiles[i][j] = pixels; + Thread.sleep(1); + + baos.write(i); + baos.write(j); + + byte[] bytesOut = baos.toByteArray(); + + if (bytesOut.length > 1000) + System.err.println(bytesOut.length); + + p.setData(bytesOut); + p.setAddress(remoteHost); + p.setPort(remotePort); + + try { + socket.send(p); + } + catch (IOException e) { + e.printStackTrace(); + } + + tiles[i][j] = pixels; + + } + catch (Exception e) { + } } @@ -156,6 +162,7 @@ public class ImageTransmitter implements Runnable { /** * Set Transmit Enabled/Disabled + * * @param transmit boolean Enabled/Disabled */ public void setTransmit(boolean transmit) { @@ -164,6 +171,7 @@ public class ImageTransmitter implements Runnable { /** * Get the encoder used to encode Images Tiles + * * @return encoder */ public ImageEncoder getEncoder() { @@ -172,6 +180,7 @@ public class ImageTransmitter implements Runnable { /** * Set the encoder used to encode Image Tiles + * * @param encoder encoder */ public void setEncoder(ImageEncoder encoder) { @@ -181,9 +190,9 @@ public class ImageTransmitter implements Runnable { /** * Stops Transmitter */ - public void stop(){ - this.transmit=false; - this.on=false; + public void stop() { + this.transmit = false; + this.on = false; socket.close(); } }