Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.php |
— | — | @@ -15,6 +15,8 @@ |
16 | 16 | // Include WebVideoTranscode ( prior to config so that its defined transcode keys can be used in configuration ) |
17 | 17 | $wgAutoloadClasses['WebVideoTranscode'] = "$timedMediaDir/WebVideoTranscode/WebVideoTranscode.php"; |
18 | 18 | |
| 19 | +// Add the rest transcode right: |
| 20 | +$wgAvailableRights[] = 'transcode-reset'; |
19 | 21 | |
20 | 22 | /******************* CONFIGURATION STARTS HERE **********************/ |
21 | 23 | |
— | — | @@ -26,11 +28,6 @@ |
27 | 29 | // ( even if there are no text tracks for that asset at render time ) |
28 | 30 | $wgMwEmbedModuleConfig['TimedText.ShowInterface'] = 'always'; |
29 | 31 | |
30 | | -/*** end MwEmbed module configuration: ******************************/ |
31 | | - |
32 | | -// Add the rest transcode right: |
33 | | -$wgAvailableRights[] = 'transcode-reset'; |
34 | | - |
35 | 32 | // Which users can restart failed or expired transcode jobs |
36 | 33 | $wgGroupPermissions['sysop']['transcode-reset'] = true; |
37 | 34 | |
Index: trunk/extensions/TimedMediaHandler/WebVideoTranscode/WebVideoTranscodeJob.php |
— | — | @@ -499,9 +499,10 @@ |
500 | 500 | if( $loopCount == 5 ){ |
501 | 501 | // only run check if we are outputing to target file |
502 | 502 | // ( 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 ){ |
506 | 507 | $this->output( $wgLang->formatSize( $newFileSize ). ' Total size, encoding ' . |
507 | 508 | $wgLang->formatSize( ( $newFileSize - $oldFileSize ) / 5 ) . ' per second' ); |
508 | 509 | if( $newFileSize == $oldFileSize ){ |
— | — | @@ -510,7 +511,9 @@ |
511 | 512 | $this->output( $errorMsg ); |
512 | 513 | // file is not growing in size, kill proccess |
513 | 514 | $retval = 1; |
514 | | - posix_kill( $pid, 9); |
| 515 | + |
| 516 | + //posix_kill( $pid, 9); |
| 517 | + self::killProcess( $pid ); |
515 | 518 | break; |
516 | 519 | } |
517 | 520 | // Wait an additional 5 seconds of the file not growing to confirm |
— | — | @@ -531,7 +534,8 @@ |
532 | 535 | $this->output( $errorMsg ); |
533 | 536 | // File is not growing in size, kill proccess |
534 | 537 | $retval = 1; |
535 | | - posix_kill( $pid, 9); |
| 538 | + //posix_kill( $pid, 9); |
| 539 | + self::killProcess( $pid ); |
536 | 540 | break; |
537 | 541 | } |
538 | 542 | |
— | — | @@ -564,11 +568,27 @@ |
565 | 569 | return false; |
566 | 570 | } |
567 | 571 | 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 ); |
569 | 575 | return false; |
570 | 576 | } |
571 | 577 | return true; |
572 | 578 | } |
| 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 | + } |
573 | 593 | /** |
574 | 594 | * Mapping between firefogg api and ffmpeg2theora command line |
575 | 595 | * |