code: public boolean canSendPacket(RTMPMessage message, long pending) {
          IRTMPEvent packet = message.getBody();
          boolean result = true;
          // We currently only drop video packets.
          if (packet instanceof VideoData) {
              VideoData video = (VideoData) packet;
              FrameType type = video.getFrameType();
              switch (state) {
                  case SEND_ALL:
                      // All packets will be sent
                      break;
                  case SEND_INTERFRAMES:
                      // Only keyframes and interframes will be sent.
                      if (type == FrameType.KEYFRAME) {
                          if (pending == 0) {
                              // Send all frames from now on.
                              state = SEND_ALL;
                          }
                      } else if (type == FrameType.INTERFRAME) {
                      }
                      break;
                  case SEND_KEYFRAMES:
                      // Only keyframes will be sent.
                      result = (type == FrameType.KEYFRAME);
                      if (result && pending == 0) {
                          // Maybe switch back to SEND_INTERFRAMES after the next keyframe
                          state = SEND_KEYFRAMES_CHECK;
                      }
                      break;
                  case SEND_KEYFRAMES_CHECK:
                      // Only keyframes will be sent.
                      result = (type == FrameType.KEYFRAME);
                      if (result && pending == 0) {
                          // Continue with sending interframes as well
                          state = SEND_INTERFRAMES;
                      }
                      break;
                  default:
              }
          }
          return result;
      }
docs: {@inheritDoc}