refactoring

This commit is contained in:
Daniil Gentili 2017-07-10 00:08:21 +02:00
parent c5135942ce
commit 9eda7c34e9
3 changed files with 18 additions and 13 deletions

View File

@ -156,7 +156,6 @@ var_dump(is_null($this->{$name}));
$this->obfuscated['decryption']->setKey(substr($reversed, 0, 32));
$this->obfuscated['decryption']->setIV(substr($reversed, 32, 16));
$random = substr_replace(
$random,
substr(

View File

@ -105,7 +105,11 @@ class Logger
self::$BIG_ENDIAN = (pack('L', 1) === pack('N', 1));
self::$bigint = PHP_INT_SIZE < 8;
if (class_exists('\danog\MadelineProto\VoIP')) {
\Threaded::extend('\danog\MadelineProto\VoIP');
try {
\Threaded::extend('\danog\MadelineProto\VoIP');
} catch (\RuntimeException $e) {
}
}
self::$colors[self::ULTRA_VERBOSE] = implode(';', [self::foreground['light_gray'], self::set['dim']]);
self::$colors[self::VERBOSE] = implode(';', [self::foreground['green'], self::set['bold']]);

View File

@ -93,24 +93,26 @@ trait AuthKeyHandler
$this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $params['protocol']['udp_p2p']);
$this->calls[$params['id']]['controller']->start();
$this->calls[$params['id']]['controller']->connect();
/*
$samplerate = 48000;
$period = 1 / $samplerate;
$writePeriod = $period * 960;
var_dump($writePeriod);
var_dump($this->calls[$params['id']]['controller']);
while ($this->calls[$params['id']]['controller']->getState() !== \danog\MadelineProto\VoIP::STATE_ESTABLISHED);
while ($this->calls[$params['id']]['controller']->getOutputState() !== \danog\MadelineProto\VoIP::AUDIO_STATE_RUNNING);
$writePeriod = $this->calls[$params['id']]['controller']->getInputParams()["writePeriod"];
$samplesSize = $this->calls[$params['id']]['controller']->getInputParams()["samplesSize"];
var_dump('SENDING DAT');
$f = fopen('output.raw', 'r');
$time = microtime(true);
while (!feof($f)) {
usleep(
(int) (($writePeriod -
(microtime(true) - $time) // Time it took me to write frames
) * 1000000)
usleep((int)
($writePeriod -
(microtime(true) - $time) // Time it took me to write frames
)
);
$time = microtime(true);
$this->calls[$params['id']]['controller']->writeFrames(stream_get_contents($f, 960 * 2));
$this->calls[$params['id']]['controller']->writeSamples(stream_get_contents($f, $samplesSize));
}
*/
$this->handle_pending_updates();
}