- add more information on the logs to track down webcam disconnections

This commit is contained in:
Richard Alam 2015-08-05 19:55:12 +00:00
parent aa6191402c
commit 1f3cff06b3
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
@ -175,9 +201,10 @@ public class VideoStreamListener implements IStreamListener {
// stop / clean up
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;
@ -42,7 +43,7 @@ package org.bigbluebutton.modules.users.services
import org.bigbluebutton.main.model.users.IMessageListener;
import org.bigbluebutton.main.model.users.events.StreamStoppedEvent;
import org.bigbluebutton.main.model.users.events.UsersConnectionEvent;
import org.bigbluebutton.modules.users.events.MeetingMutedEvent;
import org.bigbluebutton.modules.users.events.MeetingMutedEvent;
public class MessageReceiver implements IMessageListener
{
@ -521,8 +522,15 @@ 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);
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);
}