Merge pull request #739 from ritzalam/investigate-video-disconnect

- add more information on the logs to track down webcam disconnections
This commit is contained in:
Richard Alam 2015-08-05 15:59:10 -04:00
commit 77e5cf5b55
3 changed files with 46 additions and 10 deletions

View File

@ -21,10 +21,7 @@ package org.bigbluebutton.app.video;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.mina.core.buffer.IoBuffer;
import org.red5.server.api.IConnection;
import org.red5.server.api.Red5;
import org.red5.server.api.scheduling.IScheduledJob;
import org.red5.server.api.scheduling.ISchedulingService;
import org.red5.server.api.scope.IScope;
@ -34,7 +31,6 @@ import org.red5.server.api.stream.IStreamPacket;
import org.red5.server.net.rtmp.event.VideoData;
import org.red5.server.scheduling.QuartzSchedulingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.red5.logging.Red5LoggerFactory;
import com.google.gson.Gson;
@ -84,6 +80,8 @@ public class VideoStreamListener implements IStreamListener {
private volatile boolean publishing = false;
private volatile boolean streamPaused = false;
private IScope scope;
public VideoStreamListener(IScope scope, IBroadcastStream stream, Boolean record, String userId, int packetTimeout) {
@ -136,6 +134,27 @@ public class VideoStreamListener implements IStreamListener {
recordingService.record(scope.getName(), event);
}
}
if (streamPaused) {
streamPaused = false;
long now = System.currentTimeMillis();
long numSeconds = (now - lastVideoTime)/1000;
Map<String, Object> logData = new HashMap<String, Object>();
logData.put("meetingId", scope.getName());
logData.put("userId", userId);
logData.put("stream", stream.getPublishedName());
logData.put("packetCount", packetCount);
logData.put("publishing", publishing);
logData.put("pausedFor (sec)", numSeconds);
Gson gson = new Gson();
String logStr = gson.toJson(logData);
log.warn("Video stream restarted. data={}", logStr );
}
}
}
@ -152,7 +171,8 @@ public class VideoStreamListener implements IStreamListener {
public void execute(ISchedulingService service) {
long now = System.currentTimeMillis();
if ((now - lastVideoTime) > videoTimeout) {
if ((now - lastVideoTime) > videoTimeout && !streamPaused) {
streamPaused = true;
long numSeconds = (now - lastVideoTime)/1000;
Map<String, Object> logData = new HashMap<String, Object>();
@ -168,6 +188,12 @@ public class VideoStreamListener implements IStreamListener {
log.warn("Video packet timeout. data={}", logStr );
if (!publishing) {
// remove the scheduled job
scheduler.removeScheduledJob(timeoutJobName);
}
/*
if (!streamStopped) {
streamStopped = true;
// remove the scheduled job
@ -176,8 +202,9 @@ public class VideoStreamListener implements IStreamListener {
if (publishing) {
stream.stop();
}
}
*/
}
}

View File

@ -381,6 +381,7 @@ public class UserClientMessageSender {
Map<String, Object> args = new HashMap<String, Object>();
args.put("userId", msg.userId);
args.put("webcamStream", msg.stream);
args.put("serverTimestamp", System.currentTimeMillis());
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();

View File

@ -31,6 +31,7 @@ package org.bigbluebutton.modules.users.services
import org.bigbluebutton.core.model.MeetingModel;
import org.bigbluebutton.core.services.UsersService;
import org.bigbluebutton.core.vo.LockSettingsVO;
import org.bigbluebutton.main.api.JSLog;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.PresenterStatusEvent;
@ -523,6 +524,13 @@ package org.bigbluebutton.modules.users.services
private function handleUserUnsharedWebcam(msg: Object):void {
LOGGER.debug("*** handleUserUnsharedWebcam {0} **** \n", [msg.msg]);
var map:Object = JSON.parse(msg.msg);
var logData:Object = new Object();
logData.user = UsersUtil.getUserData();
logData.user.webcamStream = map.webcamStream;
logData.user.serverTimestamp = map.serverTimestamp;
JSLog.warn("UserUnsharedWebcam server message", logData);
UserManager.getInstance().getConference().unsharedWebcam(map.userId, map.webcamStream);
sendStreamStoppedEvent(map.userId, map.webcamStream);
}