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']->setKey(substr($reversed, 0, 32));
$this->obfuscated['decryption']->setIV(substr($reversed, 32, 16)); $this->obfuscated['decryption']->setIV(substr($reversed, 32, 16));
$random = substr_replace( $random = substr_replace(
$random, $random,
substr( substr(

View File

@ -105,7 +105,11 @@ class Logger
self::$BIG_ENDIAN = (pack('L', 1) === pack('N', 1)); self::$BIG_ENDIAN = (pack('L', 1) === pack('N', 1));
self::$bigint = PHP_INT_SIZE < 8; self::$bigint = PHP_INT_SIZE < 8;
if (class_exists('\danog\MadelineProto\VoIP')) { 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::ULTRA_VERBOSE] = implode(';', [self::foreground['light_gray'], self::set['dim']]);
self::$colors[self::VERBOSE] = implode(';', [self::foreground['green'], self::set['bold']]); 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']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $params['protocol']['udp_p2p']);
$this->calls[$params['id']]['controller']->start(); $this->calls[$params['id']]['controller']->start();
$this->calls[$params['id']]['controller']->connect(); $this->calls[$params['id']]['controller']->connect();
/* var_dump($this->calls[$params['id']]['controller']);
$samplerate = 48000; while ($this->calls[$params['id']]['controller']->getState() !== \danog\MadelineProto\VoIP::STATE_ESTABLISHED);
$period = 1 / $samplerate; while ($this->calls[$params['id']]['controller']->getOutputState() !== \danog\MadelineProto\VoIP::AUDIO_STATE_RUNNING);
$writePeriod = $period * 960;
var_dump($writePeriod); $writePeriod = $this->calls[$params['id']]['controller']->getInputParams()["writePeriod"];
$samplesSize = $this->calls[$params['id']]['controller']->getInputParams()["samplesSize"];
var_dump('SENDING DAT'); var_dump('SENDING DAT');
$f = fopen('output.raw', 'r'); $f = fopen('output.raw', 'r');
$time = microtime(true); $time = microtime(true);
while (!feof($f)) { while (!feof($f)) {
usleep( usleep((int)
(int) (($writePeriod - ($writePeriod -
(microtime(true) - $time) // Time it took me to write frames (microtime(true) - $time) // Time it took me to write frames
) * 1000000) )
); );
$time = microtime(true); $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(); $this->handle_pending_updates();
} }