Return-Path: X-Original-To: apmail-openmeetings-commits-archive@www.apache.org Delivered-To: apmail-openmeetings-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F210E1BD for ; Tue, 5 Feb 2013 17:26:24 +0000 (UTC) Received: (qmail 19953 invoked by uid 500); 5 Feb 2013 17:26:24 -0000 Delivered-To: apmail-openmeetings-commits-archive@openmeetings.apache.org Received: (qmail 19915 invoked by uid 500); 5 Feb 2013 17:26:24 -0000 Mailing-List: contact commits-help@openmeetings.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openmeetings.apache.org Delivered-To: mailing list commits@openmeetings.apache.org Received: (qmail 19908 invoked by uid 99); 5 Feb 2013 17:26:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 17:26:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 17:26:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 928752388A38; Tue, 5 Feb 2013 17:26:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@openmeetings.apache.org From: solomax@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130205172600.928752388A38@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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);