summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xstreamstatus.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/streamstatus.php b/streamstatus.php
index cbcf396..dc05bc3 100755
--- a/streamstatus.php
+++ b/streamstatus.php
@@ -12,14 +12,22 @@ echo "<?xml version=\"1.0\"?>\n";
echo "<status>\n";
+$session = $_REQUEST['session'];
+
+exec('echo ' .$session .' >/tmp/aa');
+
// First check that we are allowed to create a new encoding process
-$nbencprocess = exec("find ram/ -name segmenter.pid | wc | awk '{ print $1 }'");
-if ($nbencprocess >= $maxencodingprocesses)
- echo "<streamstatus>error</streamstatus><message>Error: maximun number of sessions reached</message>\n";
-else
+if (($session == "") || !count(glob('ram/' .$session)))
{
- $session = $_REQUEST['session'];
+ $nbencprocess = exec("find ram/ -name segmenter.pid | wc | awk '{ print $1 }'");
+ if ($nbencprocess >= $maxencodingprocesses)
+ echo "<streamstatus>error</streamstatus><message>Error: maximun number of sessions reached</message>\n";
+ else
+ echo "<streamstatus>error</streamstatus><message>Error: cannot create session</message>\n";
+}
+else
+{
$cnt = 0;
while ( ( count(glob('ram/' .$session . '/*.ts')) < 2 ) && ( $cnt < 25 ) )
{