mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 19:04:40 +01:00
Fix validation
This commit is contained in:
parent
f59edfaa53
commit
ee760ce3f4
@ -1 +1 @@
|
||||
Subproject commit 7ad64fad1b8a33e3cb7f6b15e9d9e70dfe7b7bd5
|
||||
Subproject commit af1848cae0e3b9d0c0c9a73e0b080f9d5714b14e
|
@ -398,9 +398,9 @@ final class Magic
|
||||
return self::$canConvert;
|
||||
}
|
||||
try {
|
||||
Ogg::convert(new ReadableBuffer("\0"), new WritableBuffer);
|
||||
Ogg::convert(new LocalFile(__DIR__.'/empty.wav'), new WritableBuffer);
|
||||
self::$canConvert = true;
|
||||
} catch (\Throwable) {
|
||||
} catch (\Throwable $e) {
|
||||
self::$canConvert = false;
|
||||
}
|
||||
return self::$canConvert;
|
||||
|
13
src/Ogg.php
13
src/Ogg.php
@ -544,11 +544,14 @@ final class Ogg
|
||||
{
|
||||
$ok = false;
|
||||
try {
|
||||
$cancel = new DeferredCancellation;
|
||||
$ogg = new self($f, $cancel->getCancellation());
|
||||
$ok = \in_array('MADELINE_ENCODER_V=1', $ogg->comments, true);
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
try {
|
||||
$cancel = new DeferredCancellation;
|
||||
$ogg = new self($f, $cancel->getCancellation());
|
||||
$ok = \in_array('MADELINE_ENCODER_V=1', $ogg->comments, true);
|
||||
} finally {
|
||||
$cancel->cancel();
|
||||
}
|
||||
} catch (\Throwable) {}
|
||||
if (!$ok) {
|
||||
throw new AssertionError("The passed file was not generated by MadelineProto or @libtgvoipbot, please pre-convert it using @libtgvoip bot or install FFI and ffmpeg to perform realtime conversion!");
|
||||
}
|
||||
|
BIN
src/empty.wav
Normal file
BIN
src/empty.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user