#include <PacketFeeder.h>
Public Types | |
typedef SmartPtr< PacketFeeder > | sptr |
typedef WeakPtr< PacketFeeder > | wptr |
Public Member Functions | |
virtual void | onLowPackets (PacketStream &ps)=0 |
The specified PacketStream is running low on packets, and you are given the opportunity at this time to add more packets to its outgoing queue. |
This is a good thing. It cuts out the extra latency from passing the event to the EventThread and getting the packets back, and in addition allows the PacketStream to never run out of data and therefore take advantage of optimizing the packet stream through packet combining. Since the callback takes place in the writing thread itself, it cannot be writing therefore you can send out a batch of packets with a better assurance they will be combined and optimized.
|
The specified PacketStream is running low on packets, and you are given the opportunity at this time to add more packets to its outgoing queue. The callback will be called at least once when the PacketStream gets sufficently low. If you do not add enough packets it may be called (actually very likely) multiple times. If the PacketStream actually runs out of packets the writer thread will wait and will attempt to reprocess the event after the suggested timeout set by PacketStream::setFeederTimeout. You can use the informational methods of ps to get information about how many packets are left and such to better optimize your sending. |