r90638 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90637‎ | r90638 | r90639 >
Date:00:39, 23 June 2011
Author:dale
Status:deferred
Tags:
Comment:
* 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 (modified) (history)
  • /trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.php
@@ -15,6 +15,8 @@
1616 // Include WebVideoTranscode ( prior to config so that its defined transcode keys can be used in configuration )
1717 $wgAutoloadClasses['WebVideoTranscode'] = "$timedMediaDir/WebVideoTranscode/WebVideoTranscode.php";
1818
 19+// Add the rest transcode right:
 20+$wgAvailableRights[] = 'transcode-reset';
1921
2022 /******************* CONFIGURATION STARTS HERE **********************/
2123
@@ -26,11 +28,6 @@
2729 // ( even if there are no text tracks for that asset at render time )
2830 $wgMwEmbedModuleConfig['TimedText.ShowInterface'] = 'always';
2931
30 -/*** end MwEmbed module configuration: ******************************/
31 -
32 -// Add the rest transcode right:
33 -$wgAvailableRights[] = 'transcode-reset';
34 -
3532 // Which users can restart failed or expired transcode jobs
3633 $wgGroupPermissions['sysop']['transcode-reset'] = true;
3734
Index: trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -499,9 +499,10 @@
500500 if( $loopCount == 5 ){
501501 // only run check if we are outputing to target file
502502 // ( two pass encoding does not output to target on first pass )
503 - if( is_file( $this->getTargetEncodePath() ) ){
504 - clearstatcache();
505 - $newFileSize = filesize( $this->getTargetEncodePath() );
 503+ clearstatcache();
 504+ $newFileSize = filesize( $this->getTargetEncodePath() );
 505+ // Don't start checking for file growth until we have an initial positive file size:
 506+ if( is_file( $this->getTargetEncodePath() ) && $newFileSize > 0 ){
506507 $this->output( $wgLang->formatSize( $newFileSize ). ' Total size, encoding ' .
507508 $wgLang->formatSize( ( $newFileSize - $oldFileSize ) / 5 ) . ' per second' );
508509 if( $newFileSize == $oldFileSize ){
@@ -510,7 +511,9 @@
511512 $this->output( $errorMsg );
512513 // file is not growing in size, kill proccess
513514 $retval = 1;
514 - posix_kill( $pid, 9);
 515+
 516+ //posix_kill( $pid, 9);
 517+ self::killProcess( $pid );
515518 break;
516519 }
517520 // Wait an additional 5 seconds of the file not growing to confirm
@@ -531,7 +534,8 @@
532535 $this->output( $errorMsg );
533536 // File is not growing in size, kill proccess
534537 $retval = 1;
535 - posix_kill( $pid, 9);
 538+ //posix_kill( $pid, 9);
 539+ self::killProcess( $pid );
536540 break;
537541 }
538542
@@ -564,11 +568,27 @@
565569 return false;
566570 }
567571 if( strpos( $processState[1], '<defunct>' ) !== false ){
568 - posix_kill( $pid, 9);
 572+ // posix kill does not seem to work
 573+ //posix_kill( $pid, 9);
 574+ self::killProcess( $pid );
569575 return false;
570576 }
571577 return true;
572578 }
 579+ /**
 580+ * Kill Application PID
 581+ *
 582+ * @param unknown_type $PID
 583+ * @return boolen
 584+ */
 585+ public static function killProcess( $pid ){
 586+ exec( "kill -9 $pid" );
 587+ exec( "ps $pid", $processState );
 588+ if( isset( $processState[1] ) ){
 589+ return false;
 590+ }
 591+ return true;
 592+ }
573593 /**
574594 * Mapping between firefogg api and ffmpeg2theora command line
575595 *

Status & tagging log