- stop sharing from server side instead of destroing the applet from the client side
This commit is contained in:
parent
4cb7faaa49
commit
57b7de8b36
@ -28,7 +28,6 @@ function setScreenCoordinates(x, y) {
|
||||
}
|
||||
|
||||
function stopApplet(){
|
||||
document.DeskShareApplet.destroy();
|
||||
removeFrame();
|
||||
}
|
||||
|
||||
|
9
bigbluebutton-client/src/org/bigbluebutton/modules/deskshare/managers/DeskshareManager.as
Executable file → Normal file
9
bigbluebutton-client/src/org/bigbluebutton/modules/deskshare/managers/DeskshareManager.as
Executable file → Normal file
@ -61,7 +61,12 @@ package org.bigbluebutton.modules.deskshare.managers
|
||||
viewWindowManager.stopViewing();
|
||||
service.disconnect();
|
||||
}
|
||||
|
||||
|
||||
public function handleStreamStoppedEvent():void {
|
||||
LogUtil.debug("Sending deskshare stopped command");
|
||||
service.stopSharingDesktop(module.getRoom(), module.getRoom());
|
||||
}
|
||||
|
||||
public function handleStreamStartedEvent(videoWidth:Number, videoHeight:Number):void {
|
||||
LogUtil.debug("Sending startViewing command");
|
||||
service.sendStartViewingNotification(videoWidth, videoHeight);
|
||||
@ -125,5 +130,7 @@ package org.bigbluebutton.modules.deskshare.managers
|
||||
LogUtil.debug("Received start vieweing command");
|
||||
viewWindowManager.startViewing(module.getRoom(), videoWidth, videoHeight);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
11
bigbluebutton-client/src/org/bigbluebutton/modules/deskshare/services/DeskshareService.as
Executable file → Normal file
11
bigbluebutton-client/src/org/bigbluebutton/modules/deskshare/services/DeskshareService.as
Executable file → Normal file
@ -18,8 +18,10 @@
|
||||
*/
|
||||
package org.bigbluebutton.modules.deskshare.services
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import flash.net.NetConnection;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import flash.net.NetConnection;
|
||||
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.modules.deskshare.services.red5.Connection;
|
||||
|
||||
@ -75,5 +77,10 @@ package org.bigbluebutton.modules.deskshare.services
|
||||
public function sendStartedViewingNotification(stream:String):void{
|
||||
conn.sendStartedViewingNotification(stream);
|
||||
}
|
||||
|
||||
public function stopSharingDesktop(meetingId: String, stream: String):void {
|
||||
conn.stopSharingDesktop(meetingId, stream);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -313,6 +313,10 @@ package org.bigbluebutton.modules.deskshare.services.red5
|
||||
nc.call("deskshare.startedToViewStream", null, stream);
|
||||
}
|
||||
|
||||
public function stopSharingDesktop(meetingId: String, stream: String):void {
|
||||
nc.call("deskshare.stopSharingDesktop", null, meetingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the server when a notification is received to start viewing the broadcast stream .
|
||||
* This method is called on successful execution of sendStartViewingNotification()
|
||||
|
2
deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/session/ISessionManagerGateway.java
Executable file → Normal file
2
deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/session/ISessionManagerGateway.java
Executable file → Normal file
@ -35,4 +35,6 @@ public interface ISessionManagerGateway {
|
||||
public void updateBlock(String room, int position, byte[] blockData, boolean keyframe, int seqNum);
|
||||
|
||||
public void updateMouseLocation(String room, Point loc, int seqNum);
|
||||
|
||||
public boolean isSharingStopped(String meetingId);
|
||||
}
|
||||
|
19
deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/socket/BlockStreamEventMessageHandler.java
Executable file → Normal file
19
deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/socket/BlockStreamEventMessageHandler.java
Executable file → Normal file
@ -44,12 +44,12 @@ public class BlockStreamEventMessageHandler extends IoHandlerAdapter {
|
||||
}
|
||||
|
||||
private void closeSession(IoSession session) {
|
||||
String room = (String)session.getAttribute(ROOM, null);
|
||||
if (room != null) {
|
||||
log.info("Closing session [" + room + "]. ");
|
||||
} else {
|
||||
log.info("Cannot determine session to close.");
|
||||
}
|
||||
String room = (String)session.getAttribute(ROOM, null);
|
||||
if (room != null) {
|
||||
log.info("Closing session [" + room + "]. ");
|
||||
} else {
|
||||
log.info("Cannot determine session to close.");
|
||||
}
|
||||
CloseFuture future = session.close(true);
|
||||
}
|
||||
|
||||
@ -64,6 +64,13 @@ public class BlockStreamEventMessageHandler extends IoHandlerAdapter {
|
||||
// System.out.println("Got CaptureUpdateBlockEvent");
|
||||
CaptureUpdateBlockEvent event = (CaptureUpdateBlockEvent) message;
|
||||
sessionManager.updateBlock(event.getRoom(), event.getPosition(), event.getVideoData(), event.isKeyFrame(), event.getSequenceNum());
|
||||
if (sessionManager.isSharingStopped(event.getRoom())) {
|
||||
// The flash client told us to stop sharing. Force stopping by closing connection from applet.
|
||||
// We're changing how to tell the applet to stop sharing as AS ExternalInterface to JS to Applet calls
|
||||
// generates a popup dialog that users may or may not see causing the browser to hang. (ralam aug 24, 2014)
|
||||
log.info("Sharing has stopped for meeting [" + event.getRoom() + "]. Closing connection.");
|
||||
session.close(true);
|
||||
}
|
||||
} else if (message instanceof CaptureEndBlockEvent) {
|
||||
CaptureEndBlockEvent event = (CaptureEndBlockEvent) message;
|
||||
sessionManager.removeSession(event.getRoom(), event.getSequenceNum());
|
||||
|
20
deskshare/app/src/main/scala/org/bigbluebutton/deskshare/server/sessions/SessionManagerGateway.scala
Executable file → Normal file
20
deskshare/app/src/main/scala/org/bigbluebutton/deskshare/server/sessions/SessionManagerGateway.scala
Executable file → Normal file
@ -30,7 +30,7 @@ class SessionManagerGateway(streamManager: StreamManager, keyFrameInterval: Int,
|
||||
|
||||
streamManager.start
|
||||
val sessionManager: SessionManagerSVC = new SessionManagerSVC(streamManager, keyFrameInterval, interframeInterval, waitForAllBlocks)
|
||||
sessionManager.start
|
||||
sessionManager.start
|
||||
|
||||
def createSession(room: String, screenDim: org.bigbluebutton.deskshare.common.Dimension, blockDim: org.bigbluebutton.deskshare.common.Dimension, seqNum: Int, useSVC2: Boolean): Unit = {
|
||||
log.info("SessionManagerGateway:createSession for %s", room)
|
||||
@ -56,4 +56,22 @@ class SessionManagerGateway(streamManager: StreamManager, keyFrameInterval: Int,
|
||||
log.info("SessionManagerGateway:sendKeyFrame for %s", room)
|
||||
sessionManager ! new SendKeyFrame(room)
|
||||
}
|
||||
|
||||
def stopSharingDesktop(meetingId: String, stream: String) {
|
||||
sessionManager ! new StopSharingDesktop(meetingId, stream)
|
||||
}
|
||||
|
||||
def isSharingStopped(meetingId: String): Boolean = {
|
||||
var stopped = false
|
||||
sessionManager !? (3000, IsSharingStopped(meetingId)) match {
|
||||
case None => stopped = true
|
||||
case Some(rep) => {
|
||||
val reply = rep.asInstanceOf[IsSharingStoppedReply]
|
||||
stopped = reply.stopped
|
||||
}
|
||||
}
|
||||
|
||||
stopped
|
||||
}
|
||||
|
||||
}
|
||||
|
55
deskshare/app/src/main/scala/org/bigbluebutton/deskshare/server/sessions/SessionManagerSVC.scala
Executable file → Normal file
55
deskshare/app/src/main/scala/org/bigbluebutton/deskshare/server/sessions/SessionManagerSVC.scala
Executable file → Normal file
@ -21,7 +21,6 @@ package org.bigbluebutton.deskshare.server.sessions
|
||||
import scala.actors.Actor
|
||||
import scala.actors.Actor._
|
||||
import net.lag.logging.Logger
|
||||
|
||||
import scala.collection.mutable.HashMap
|
||||
import org.bigbluebutton.deskshare.server.svc1.Dimension
|
||||
import org.bigbluebutton.deskshare.server.stream.StreamManager
|
||||
@ -32,25 +31,45 @@ case class RemoveSession(room: String)
|
||||
case class SendKeyFrame(room: String)
|
||||
case class UpdateBlock(room: String, position: Int, blockData: Array[Byte], keyframe: Boolean, seqNum: Int)
|
||||
case class UpdateMouseLocation(room: String, mouseLoc:Point, seqNum: Int)
|
||||
case class StopSharingDesktop(meetingId: String, stream: String)
|
||||
case class IsSharingStopped(meetingId: String)
|
||||
case class IsSharingStoppedReply(meetingId: String, stopped: Boolean)
|
||||
|
||||
class SessionManagerSVC(streamManager: StreamManager, keyFrameInterval: Int, interframeInterval: Int, waitForAllBlocks: Boolean) extends Actor {
|
||||
private val log = Logger.get
|
||||
|
||||
private val sessions = new HashMap[String, SessionSVC]
|
||||
|
||||
private val stoppedSessions = new HashMap[String, String]
|
||||
|
||||
def act() = {
|
||||
loop {
|
||||
react {
|
||||
case c: CreateSession => createSession(c); printMailbox("CreateSession")
|
||||
case r: RemoveSession => removeSession(r.room); printMailbox("RemoveSession")
|
||||
case k: SendKeyFrame => sendKeyFrame(k.room); printMailbox("SendKeyFrame")
|
||||
case ub: UpdateBlock => updateBlock(ub.room, ub.position, ub.blockData, ub.keyframe, ub.seqNum)
|
||||
case ml: UpdateMouseLocation => updateMouseLocation(ml.room, ml.mouseLoc, ml.seqNum)
|
||||
case m: Any => log.warning("SessionManager: Unknown message " + m); printMailbox("Any")
|
||||
case msg: CreateSession => createSession(msg); printMailbox("CreateSession")
|
||||
case msg: RemoveSession => removeSession(msg.room); printMailbox("RemoveSession")
|
||||
case msg: SendKeyFrame => sendKeyFrame(msg.room); printMailbox("SendKeyFrame")
|
||||
case msg: UpdateBlock => updateBlock(msg.room, msg.position, msg.blockData, msg.keyframe, msg.seqNum)
|
||||
case msg: UpdateMouseLocation => updateMouseLocation(msg.room, msg.mouseLoc, msg.seqNum)
|
||||
case msg: StopSharingDesktop => handleStopSharingDesktop(msg)
|
||||
case msg: IsSharingStopped => handleIsSharingStopped(msg)
|
||||
|
||||
case msg: Any => log.warning("SessionManager: Unknown message " + msg); printMailbox("Any")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def handleStopSharingDesktop(msg: StopSharingDesktop) {
|
||||
sessions.get(msg.meetingId) foreach { s =>
|
||||
stoppedSessions += msg.meetingId -> msg.stream
|
||||
}
|
||||
}
|
||||
|
||||
private def handleIsSharingStopped(msg: IsSharingStopped) {
|
||||
stoppedSessions.get(msg.meetingId) match {
|
||||
case Some(s) => reply(new IsSharingStoppedReply(msg.meetingId, true))
|
||||
case None => reply(new IsSharingStoppedReply(msg.meetingId, false))
|
||||
}
|
||||
}
|
||||
|
||||
private def printMailbox(caseMethod: String) {
|
||||
log.debug("SessionManager: mailbox %d message %s", mailboxSize, caseMethod)
|
||||
}
|
||||
@ -84,16 +103,16 @@ class SessionManagerSVC(streamManager: StreamManager, keyFrameInterval: Int, int
|
||||
}
|
||||
}
|
||||
|
||||
private def removeSession(room: String): Unit = {
|
||||
log.debug("SessionManager: Removing session " + room);
|
||||
sessions.get(room) match {
|
||||
case Some(s) => {
|
||||
s ! StopSession; log.debug("++++ REMOVE SESSION +++%s", room);
|
||||
val old:Int = sessions.size
|
||||
sessions -= room;
|
||||
log.debug("RemoveSession: Session length [%d,%d]", old, sessions.size)
|
||||
}
|
||||
case None => log.warning("SessionManager: Could not remove session %s. Does not exist.", room)
|
||||
private def removeSession(meetingId: String): Unit = {
|
||||
log.debug("SessionManager: Removing session " + meetingId);
|
||||
sessions.get(meetingId) foreach { s =>
|
||||
s ! StopSession; log.debug("++++ REMOVE SESSION +++%s", meetingId);
|
||||
val old:Int = sessions.size
|
||||
sessions -= meetingId;
|
||||
log.debug("RemoveSession: Session length [%d,%d]", old, sessions.size)
|
||||
stoppedSessions.get(meetingId) foreach {ss =>
|
||||
stoppedSessions -= meetingId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
5
deskshare/app/src/main/scala/org/bigbluebutton/deskshare/server/stream/DeskshareService.scala
Executable file → Normal file
5
deskshare/app/src/main/scala/org/bigbluebutton/deskshare/server/stream/DeskshareService.scala
Executable file → Normal file
@ -55,4 +55,9 @@ class DeskshareService(streamManager: StreamManager, sessionGateway: SessionMana
|
||||
log.debug("DeskshareService: Started viewing stream for room %s", stream)
|
||||
sessionGateway.sendKeyFrame(stream)
|
||||
}
|
||||
|
||||
def stopSharingDesktop(meetingId: String) {
|
||||
log.debug("DeskshareService: Stop sharing for meeting [%s]", meetingId)
|
||||
sessionGateway.stopSharingDesktop(meetingId, meetingId)
|
||||
}
|
||||
}
|
||||
|
1
deskshare/applet/src/main/java/org/bigbluebutton/deskshare/client/net/NetworkSocketStreamSender.java
Executable file → Normal file
1
deskshare/applet/src/main/java/org/bigbluebutton/deskshare/client/net/NetworkSocketStreamSender.java
Executable file → Normal file
@ -25,7 +25,6 @@ import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.bigbluebutton.deskshare.client.ExitCode;
|
||||
import org.bigbluebutton.deskshare.common.Dimension;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user