openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solo...@apache.org
Subject svn commit: r1442668 - in /openmeetings/trunk/singlewebapp/src/org/apache/openmeetings: data/flvrecord/listener/async/BaseStreamWriter.java remote/red5/ScopeApplicationAdapter.java screen/webstart/gui/ScreenSharerFrame.java
Date Tue, 05 Feb 2013 17:26:00 GMT
Author: solomax
Date: Tue Feb  5 17:26:00 2013
New Revision: 1442668

URL: http://svn.apache.org/viewvc?rev=1442668&view=rev
Log:
[OPENMEETINGS-526] additional checks while start/stop sharing/recording

Modified:
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/flvrecord/listener/async/BaseStreamWriter.java
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/screen/webstart/gui/ScreenSharerFrame.java

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/flvrecord/listener/async/BaseStreamWriter.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/flvrecord/listener/async/BaseStreamWriter.java?rev=1442668&r1=1442667&r2=1442668&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/flvrecord/listener/async/BaseStreamWriter.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/flvrecord/listener/async/BaseStreamWriter.java
Tue Feb  5 17:26:00 2013
@@ -110,7 +110,7 @@ public abstract class BaseStreamWriter i
 
 	private void open() {
 		running = true;
-		new Thread(this).start();
+		new Thread(this, "Recording " + file.getName()).start();
 	}
 
 	public void stop() {

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java?rev=1442668&r1=1442667&r2=1442668&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/red5/ScopeApplicationAdapter.java
Tue Feb  5 17:26:00 2013
@@ -215,7 +215,7 @@ public class ScopeApplicationAdapter ext
 			log.debug("-----------  ");
 			if (rc != null) {
 				boolean changed = false;
-				if (Boolean.valueOf("" + map.get("stopStreaming"))) {
+				if (Boolean.valueOf("" + map.get("stopStreaming")) && rc.isStartStreaming())
{
 					changed = true;
 					rc.setStartStreaming(false);
 					//Send message to all users
@@ -223,7 +223,7 @@ public class ScopeApplicationAdapter ext
 					
 					returnMap.put("result", "stopSharingOnly");
 				}
-				if (Boolean.valueOf("" + map.get("stopRecording"))) {
+				if (Boolean.valueOf("" + map.get("stopRecording")) && rc.getIsRecording()) {
 					changed = true;
 					rc.setStartRecording(false);
 					rc.setIsRecording(false);
@@ -234,7 +234,7 @@ public class ScopeApplicationAdapter ext
 
 					flvRecorderService.stopRecordAndSave(current.getScope(), rc, null);
 				}
-				if (Boolean.valueOf("" + map.get("stopPublishing"))) {
+				if (Boolean.valueOf("" + map.get("stopPublishing")) && rc.isScreenPublishStarted())
{
 					changed = true;
 					rc.setScreenPublishStarted(false);
 					returnMap.put("result", "stopPublishingOnly");
@@ -319,9 +319,11 @@ public class ScopeApplicationAdapter ext
 				SessionVariablesUtil.setUserId(current.getClient(), Long.parseLong(map.get("user_id")
 						.toString()));
 
+				boolean alreadyStreaming = currentClient.isStartStreaming();
 				if (startStreaming) {
 					currentClient.setStartStreaming(true);
 				}
+				boolean alreadyRecording = currentClient.isStartRecording();
 				if (startRecording) {
 					currentClient.setStartRecording(true);
 				}
@@ -376,20 +378,27 @@ public class ScopeApplicationAdapter ext
 						.getClient().getId(), currentClient, false, null);
 
 				if (startStreaming) {
-					returnMap.put("modus", "startStreaming");
-
-					log.debug("start streamPublishStart Is Screen Sharing ");
-					
-					//Send message to all users
-					syncMessageToCurrentScope("newScreenSharing", currentClient, false);
+					if (!alreadyStreaming) {
+						returnMap.put("modus", "startStreaming");
+	
+						log.debug("start streamPublishStart Is Screen Sharing ");
+						
+						//Send message to all users
+						syncMessageToCurrentScope("newScreenSharing", currentClient, false);
+					} else {
+						log.warn("Streaming is already started for the client id=" + currentClient.getId()
+ ". Second request is ignored.");
+					}
 				} else if (startRecording) {
-					returnMap.put("modus", "startRecording");
-
-					String recordingName = "Recording "
-							+ CalendarPatterns
-									.getDateWithTimeByMiliSeconds(new Date());
-
-					flvRecorderService.recordMeetingStream(recordingName, "", false);
+					if (!alreadyRecording) {
+						returnMap.put("modus", "startRecording");
+	
+						String recordingName = "Recording "
+								+ CalendarPatterns.getDateWithTimeByMiliSeconds(new Date());
+	
+						flvRecorderService.recordMeetingStream(recordingName, "", false);
+					} else {
+						log.warn("Recording is already started for the client id=" + currentClient.getId()
+ ". Second request is ignored.");
+					}
 				} else if (startPublishing) {
 					syncMessageToCurrentScope("startedPublishing", new Object[]{currentClient, "rtmp://"
+ map.get("publishingHost") + ":1935/"
 							+ map.get("publishingApp") + "/" + map.get("publishingId")}, false, true);

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/screen/webstart/gui/ScreenSharerFrame.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/screen/webstart/gui/ScreenSharerFrame.java?rev=1442668&r1=1442667&r2=1442668&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/screen/webstart/gui/ScreenSharerFrame.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/screen/webstart/gui/ScreenSharerFrame.java
Tue Feb  5 17:26:00 2013
@@ -89,6 +89,9 @@ public class ScreenSharerFrame extends J
 	private boolean sharingStarted = false;
 	private boolean recordingStarted = false;
 	private boolean publishStarted = false;
+	private boolean recordingActionRequested = false;
+	private boolean publishingActionRequested = false;
+	private boolean sharingActionRequested = false;
 	private ImageIcon startIcon;
 	private ImageIcon stopIcon;
 	private String startSharingLabel;
@@ -257,9 +260,19 @@ public class ScreenSharerFrame extends J
 		btnStartStopSharing.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent arg0) {
 				if (sharingStarted) {
-					core.sendCaptureScreenStop(true, false);
+					if (!sharingActionRequested) {
+						sharingActionRequested = true;
+						core.sendCaptureScreenStop(true, false);
+					} else {
+						logger.warn("Sharing action is already requested");
+					}
 				} else {
-					core.captureScreenStart(true, false);
+					if (!sharingActionRequested) {
+						sharingActionRequested = true;
+						core.captureScreenStart(true, false);
+					} else {
+						logger.warn("Sharing action is already requested");
+					}
 				}
 			}
 		});
@@ -443,9 +456,19 @@ public class ScreenSharerFrame extends J
 		btnStartStopRecording.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent arg0) {
 				if (recordingStarted) {
-					core.sendCaptureScreenStop(false, true);
+					if (!recordingActionRequested) {
+						recordingActionRequested = true;
+						core.sendCaptureScreenStop(false, true);
+					} else {
+						logger.warn("Recording action is already requested");
+					}
 				} else {
-					core.captureScreenStart(false, true);
+					if (!recordingActionRequested) {
+						recordingActionRequested = true;
+						core.captureScreenStart(false, true);
+					} else {
+						logger.warn("Recording action is already requested");
+					}
 				}
 			}
 		});
@@ -500,9 +523,19 @@ public class ScreenSharerFrame extends J
 		btnStartStopPublish.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent arg0) {
 				if (publishStarted) {
-					core.sendStopPublishing();
+					if (!publishingActionRequested) {
+						publishingActionRequested = true;
+						core.sendStopPublishing();
+					} else {
+						logger.warn("Publishing action is already requested");
+					}
 				} else {
-					core.captureScreenStart(false, false, true);
+					if (!publishingActionRequested) {
+						publishingActionRequested = true;
+						core.captureScreenStart(false, false, true);
+					} else {
+						logger.warn("Publishing action is already requested");
+					}
 				}
 			}
 		});
@@ -527,6 +560,9 @@ public class ScreenSharerFrame extends J
 
 	public void setSharingStatus(boolean status, boolean unlockScreen) {
 		panelScreen.setEnabled(unlockScreen);
+		if (status != sharingStarted) {
+			sharingActionRequested = false;
+		}
 		sharingStarted = status;
 		btnStartStopSharing.setIcon(status ? stopIcon : startIcon);
 		btnStartStopSharing.setText(status ? stopSharingLabel : startSharingLabel);
@@ -535,6 +571,10 @@ public class ScreenSharerFrame extends J
 	
 	public void setRecordingStatus(boolean status, boolean unlockScreen) {
 		panelScreen.setEnabled(unlockScreen);
+		if (status != recordingStarted) {
+			recordingActionRequested = false;
+		}
+		logger.debug("recordingActionRequested=" + recordingActionRequested);
 		recordingStarted = status;
 		btnStartStopRecording.setIcon(status ? stopIcon : startIcon);
 		btnStartStopRecording.setText(status ? stopRecordingLabel : startRecordingLabel);
@@ -543,6 +583,9 @@ public class ScreenSharerFrame extends J
 	
 	public void setPublishingStatus(boolean status, boolean unlockScreen) {
 		panelScreen.setEnabled(unlockScreen);
+		if (status != publishStarted) {
+			publishingActionRequested = false;
+		}
 		publishStarted = status;
 		btnStartStopPublish.setIcon(status ? stopIcon : startIcon);
 		btnStartStopPublish.setText(status ? stopPublishLabel : startPublishLabel);



Mime
View raw message