streamdog.php 1.1 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. if (ubRouting::get('action') == 'streamdog') {
  3. $streamDog = new StreamDog();
  4. $liveCams = new LiveCams();
  5. //running main live-streams processing
  6. $allRunningStreams = $liveCams->getRunningStreams();
  7. if (!empty($allRunningStreams)) {
  8. foreach ($allRunningStreams as $eachCameraId => $eachPid) {
  9. //camera not in use?
  10. if (!$streamDog->isCameraInUse($eachCameraId)) {
  11. $liveCams->stopStream($eachCameraId);
  12. //log_register('STREAMDOG LIVE ['.$eachCameraId.'] STOPPED NOT IN USE IN '.$streamDog::TIMEOUT);
  13. }
  14. }
  15. }
  16. //running sub-streams processing
  17. $allRunningSubStreams=$liveCams->getRunningSubStreams();
  18. if (!empty($allRunningSubStreams)) {
  19. foreach ($allRunningSubStreams as $eachCameraId=>$eachPid) {
  20. if (!$streamDog->isCameraSubInUse($eachCameraId)) {
  21. $liveCams->stopSubStream($eachCameraId);
  22. log_register('STREAMDOG SUB ['.$eachCameraId.'] STOPPED NOT IN USE IN '.$streamDog::SUB_TIMEOUT);
  23. }
  24. }
  25. }
  26. die('OK:STREAMDOG');
  27. }