code: public void dropPacket(RTMPMessage message) {
          IRTMPEvent packet = message.getBody();
          // Only check video packets.
          if (packet instanceof VideoData) {
              VideoData video = (VideoData) packet;
              FrameType type = video.getFrameType();
              switch (state) {
                  case SEND_ALL:
                      if (type == FrameType.DISPOSABLE_INTERFRAME) {
                          // Remain in state, packet is safe to drop.
                          return;
                      } else if (type == FrameType.INTERFRAME) {
                          // Drop all frames until the next keyframe.
                          state = SEND_KEYFRAMES;
                          return;
                      } else if (type == FrameType.KEYFRAME) {
                          // Drop all frames until the next keyframe.
                          state = SEND_KEYFRAMES;
                          return;
                      }
                      break;
                  case SEND_INTERFRAMES:
                      if (type == FrameType.INTERFRAME) {
                          // Drop all frames until the next keyframe.
                          state = SEND_KEYFRAMES_CHECK;
                          return;
                      } else if (type == FrameType.KEYFRAME) {
                          // Drop all frames until the next keyframe.
                          state = SEND_KEYFRAMES;
                          return;
                      }
                      break;
                  case SEND_KEYFRAMES:
                      // Remain in state.
                      break;
                  case SEND_KEYFRAMES_CHECK:
                      if (type == FrameType.KEYFRAME) {
                          // Switch back to sending keyframes, but don't move to
                          // SEND_INTERFRAMES afterwards.
                          state = SEND_KEYFRAMES;
                          return;
                      }
                      break;
                  default:
              }
          }
      }
docs: {@inheritDoc}