fix: unbloc ffmpeg on some broken videos

Co-authored-by: Joas Schilling <coding@schilljs.com>

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
pull/53431/head
Arthur Schiwon 2025-05-20 18:14:30 +07:00
parent 5cddf5a85d
commit 6e9bccddf4
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
5 changed files with 27 additions and 6 deletions

@ -107,7 +107,7 @@ Files: tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess
Copyright: 2016 ownCloud, Inc., 2019 Nextcloud GmbH and Nextcloud contributors
License: AGPL-3.0-only
Files: core/img/favicon*.* core/img/logo/logo*.* tests/data/testimage.webp apps/testing/img/logo.png core/img/apps/spreed.svg
Files: core/img/favicon*.* core/img/logo/logo*.* tests/data/testimage.webp tests/data/broken-video.webm apps/testing/img/logo.png core/img/apps/spreed.svg
Copyright: 2016-2024 Nextcloud GmbH
License: LicenseRef-NextcloudTrademarks

@ -135,8 +135,8 @@ class Movie extends ProviderV2 {
$returnCode = -1;
$output = '';
if (is_resource($proc)) {
$stdout = trim(stream_get_contents($pipes[1]));
$stderr = trim(stream_get_contents($pipes[2]));
$stdout = trim(stream_get_contents($pipes[1]));
$returnCode = proc_close($proc);
$output = $stdout . $stderr;
}

Binary file not shown.

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Preview;
/**
* Class MovieTest
*
* @group DB
*
* @package Test\Preview
*/
class MovieBrokenStuckFfmpegTest extends MovieTest {
protected string $fileName = 'broken-video.webm';
}

@ -15,6 +15,10 @@ namespace Test\Preview;
* @package Test\Preview
*/
class MovieTest extends Provider {
protected string $fileName = 'testimage.mp4';
protected int $width = 560;
protected int $height = 320;
protected function setUp(): void {
$avconvBinary = \OC_Helper::findBinaryPath('avconv');
$ffmpegBinary = ($avconvBinary) ? null : \OC_Helper::findBinaryPath('ffmpeg');
@ -25,10 +29,7 @@ class MovieTest extends Provider {
\OC\Preview\Movie::$avconvBinary = $avconvBinary;
\OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary;
$fileName = 'testimage.mp4';
$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
$this->width = 560;
$this->height = 320;
$this->imgPath = $this->prepareTestFile($this->fileName, \OC::$SERVERROOT . '/tests/data/' . $this->fileName);
$this->provider = new \OC\Preview\Movie;
} else {
$this->markTestSkipped('No Movie provider present');