fix: unbloc ffmpeg on some broken videos

Co-authored-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon
2025-05-20 18:14:30 +02:00
parent 68b2a6261d
commit bdc68989d5
5 changed files with 27 additions and 6 deletions

View File

@ -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

View File

@ -166,8 +166,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.

View File

@ -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';
}

View File

@ -18,6 +18,10 @@ use OCP\Server;
* @package Test\Preview
*/
class MovieTest extends Provider {
protected string $fileName = 'testimage.mp4';
protected int $width = 560;
protected int $height = 320;
protected function setUp(): void {
$binaryFinder = Server::get(IBinaryFinder::class);
$movieBinary = $binaryFinder->findBinaryPath('avconv');
@ -28,10 +32,7 @@ class MovieTest extends Provider {
if (is_string($movieBinary)) {
parent::setUp();
$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(['movieBinary' => $movieBinary]);
} else {
$this->markTestSkipped('No Movie provider present');