This is one case where it might make a difference to have a local variable with the buffer size rather than make a call. Creating a frame is one of the more expensive operations in python, so while I would agree that usually this isn't a concern, it might be here. At 20Mbps (my phone has downloaded faster over 4G), that's 2560 calls per second to read(), and an additional 2560 calls to the buffer_size getter. And at local network speeds, that obviously goes up quite a bit.