code: private boolean okayToSendMessage(IRTMPEvent message) {
          if (message instanceof IStreamData) {
              final long now = System.currentTimeMillis();
              // check client buffer size
              if (isClientBufferFull(now)) {
                  return false;
              }
              // get pending message count
              long pending = pendingMessages();
              if (bufferCheckInterval > 0 && now >= nextCheckBufferUnderrun) {
                  if (pending > underrunTrigger) {
                      // client is playing behind speed, notify him
                      sendInsufficientBandwidthStatus(currentItem.get());
                  }
                  nextCheckBufferUnderrun = now + bufferCheckInterval;
              }
              // check for under run
              if (pending > underrunTrigger) {
                  // too many messages already queued on the connection
                  return false;
              }
              return true;
          } else {
              String itemName = "Undefined";
              // if current item exists get the name to help debug this issue
              if (currentItem.get() != null) {
                  itemName = currentItem.get().getName();
              }
              Object[] errorItems = new Object[] { message.getClass(), message.getDataType(), itemName };
              throw new RuntimeException(String.format("Expected IStreamData but got %s (type %s) for %s", errorItems));
          }
      }
docs: Check if it's okay to send the client more data. This takes the configured bandwidth as well as the requested client buffer into
  account.
  
  @param message
  @return true if it is ok to send more, false otherwise