http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90638
Revision: 90638
Author: dale
Date: 2011-06-23 00:39:48 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
* Don't start checking for file growth until we have an initial positive file
size
* switched to exec kill for pid since posx_kill was not working as planed
* don't start checking for file growth until it has a non-zero size ( issue
with two pass ffmpeg2theora )
Modified Paths:
--------------
trunk/extensions/TimedMediaHandler/TimedMediaHandler.php
trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php
Modified: trunk/extensions/TimedMediaHandler/TimedMediaHandler.php
===================================================================
--- trunk/extensions/TimedMediaHandler/TimedMediaHandler.php 2011-06-23
00:37:23 UTC (rev 90637)
+++ trunk/extensions/TimedMediaHandler/TimedMediaHandler.php 2011-06-23
00:39:48 UTC (rev 90638)
@@ -15,6 +15,8 @@
// Include WebVideoTranscode ( prior to config so that its defined transcode
keys can be used in configuration )
$wgAutoloadClasses['WebVideoTranscode'] =
"$timedMediaDir/WebVideoTranscode/WebVideoTranscode.php";
+// Add the rest transcode right:
+$wgAvailableRights[] = 'transcode-reset';
/******************* CONFIGURATION STARTS HERE **********************/
@@ -26,11 +28,6 @@
// ( even if there are no text tracks for that asset at render time )
$wgMwEmbedModuleConfig['TimedText.ShowInterface'] = 'always';
-/*** end MwEmbed module configuration: ******************************/
-
-// Add the rest transcode right:
-$wgAvailableRights[] = 'transcode-reset';
-
// Which users can restart failed or expired transcode jobs
$wgGroupPermissions['sysop']['transcode-reset'] = true;
Modified:
trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php
===================================================================
---
trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php
2011-06-23 00:37:23 UTC (rev 90637)
+++
trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php
2011-06-23 00:39:48 UTC (rev 90638)
@@ -499,9 +499,10 @@
if( $loopCount == 5 ){
// only run check if we are outputing to target
file
// ( two pass encoding does not output to
target on first pass )
- if( is_file( $this->getTargetEncodePath() ) ){
- clearstatcache();
- $newFileSize = filesize(
$this->getTargetEncodePath() );
+ clearstatcache();
+ $newFileSize = filesize(
$this->getTargetEncodePath() );
+ // Don't start checking for file growth until
we have an initial positive file size:
+ if( is_file( $this->getTargetEncodePath() ) &&
$newFileSize > 0 ){
$this->output( $wgLang->formatSize(
$newFileSize ). ' Total size, encoding ' .
$wgLang->formatSize( (
$newFileSize - $oldFileSize ) / 5 ) . ' per second' );
if( $newFileSize == $oldFileSize ){
@@ -510,7 +511,9 @@
$this->output(
$errorMsg );
// file is not growing
in size, kill proccess
$retval = 1;
- posix_kill( $pid, 9);
+
+ //posix_kill( $pid, 9);
+ self::killProcess( $pid
);
break;
}
// Wait an additional 5 seconds
of the file not growing to confirm
@@ -531,7 +534,8 @@
$this->output( $errorMsg );
// File is not growing in size, kill proccess
$retval = 1;
- posix_kill( $pid, 9);
+ //posix_kill( $pid, 9);
+ self::killProcess( $pid );
break;
}
@@ -564,11 +568,27 @@
return false;
}
if( strpos( $processState[1], '<defunct>' ) !== false ){
- posix_kill( $pid, 9);
+ // posix kill does not seem to work
+ //posix_kill( $pid, 9);
+ self::killProcess( $pid );
return false;
}
return true;
}
+ /**
+ * Kill Application PID
+ *
+ * @param unknown_type $PID
+ * @return boolen
+ */
+ public static function killProcess( $pid ){
+ exec( "kill -9 $pid" );
+ exec( "ps $pid", $processState );
+ if( isset( $processState[1] ) ){
+ return false;
+ }
+ return true;
+ }
/**
* Mapping between firefogg api and ffmpeg2theora command line
*
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs