Merge pull request #60916 from adduxa/fix/previews/ffprobe-hangs

fix(previews): ffprobe hangs
This commit is contained in:
Louis 2026-06-09 11:37:17 +02:00 committed by GitHub
commit 22ed3c3d15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -32,6 +32,7 @@
- Andreas Pflug <dev@admin4.org>
- Andrew Brown <andrew@casabrown.com>
- Andrey Borysenko <andrey.borysenko@nextcloud.com>
- Andrey Dyakov <adduxa@gmail.com>
- André Gaul <gaul@web-yard.de>
- Andy Xheli <axheli@axtsolutions.com>
- Anna Larch <anna@nextcloud.com>

View file

@ -289,8 +289,10 @@ class Movie extends ProviderV2 {
if ($test_hdr_proc === false) {
return false;
}
$test_hdr_stdout = trim(stream_get_contents($test_hdr_pipes[1]));
// Read stderr before stdout: ffprobe's stderr can exceed 64KB (OS pipe buffer) for certain
// files, causing a deadlock if stdout is read first. stdout is always a short string.
$test_hdr_stderr = trim(stream_get_contents($test_hdr_pipes[2]));
$test_hdr_stdout = trim(stream_get_contents($test_hdr_pipes[1]));
proc_close($test_hdr_proc);
// search build options for libzimg (provides zscale filter)
$ffmpeg_libzimg_installed = strpos($test_hdr_stderr, '--enable-libzimg');
@ -341,6 +343,8 @@ class Movie extends ProviderV2 {
$returnCode = -1;
$output = '';
if (is_resource($proc)) {
// Read stderr before stdout: ffmpeg's stderr can exceed 64KB (OS pipe buffer) for certain
// files, causing a deadlock if stdout is read first. stdout is always empty.
$stderr = trim(stream_get_contents($pipes[2]));
$stdout = trim(stream_get_contents($pipes[1]));
$returnCode = proc_close($proc);