-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace Communication\Connection::waitForDelay's usleep with select #606
Comments
This method is a prerequisite to eventually resolving chrome-php/chrome#606
For this to be fixed, \Wrench\Client needs a getSocketResource() method. Made a PR: chrome-php/wrench#17 Before more progress can be made, it seems we need to wait for the method/PR to be accepted, and wait for a new chrome-php/wrench version to be released 🤔 Here is my investigation notes so far: \HeadlessChromium\Communication\Socket\SocketInterface has no getSocketResource(). \HeadlessChromium\Communication\Socket\Wrench must then create its own getSocketResource(), \Wrench\Socket\ClientSocket inherits $this->socket property from UriSocket... \Wrench\Socket\UriSocket inherits $this->socket property from \Wrench\Socket\AbstractSocket... \Wrench\Socket\AbstractSocket has a public function getResource() that means UriSocket has it too... that means ClientSocket also has it.. \Wrench\Client needs to expose it publicly (or at least protectedly) |
* Add getSocketResource method to enhance socket management This method is a prerequisite to eventually resolving chrome-php/chrome#606 * StyleCI * public function waitForData * remove getSocketResource * StyleCI * StyleCI * error message * oops use stream_select not socket_select * error handling
update: The upcoming Wrench 1.7 will have a new \Wrench\Client::waitForData method which uses select() internally, we should replace |
@divinity76 Are you planning on picking up the next step of this, with a PR to this repo? |
@GrahamCampbell no, I've since lost interest, I made some workaround for my specific problem and moved on. But yes that's exactly what I had in mind! |
OK, I can make the change then. I just didn't want to be treading on toes. ;) |
@GrahamCampbell perfect, thanks |
the usleep in
chrome/src/Communication/Connection.php
Lines 212 to 219 in 2b7cb13
is problematic, it should be a socket_select() / stream_select(), and the usleep causes laggy/non-smooth video recordings with Page.startScreencast + method:Page.screencastFrame (sample implementation here )
So when I record videos, to make them smooth, I have to replace stuff like
with a cpu busyloop like
That's a dirty quickfix, and I believe the correct solution would be to replace Communication\Connection::waitForDelay's usleep() with select() , it should be something like
But first issue is to figure out how to get $page's socket handle into function waitForDelay 🤔 and seems the raw socket handle is wrapped inside wrench... suggestions?
The text was updated successfully, but these errors were encountered: