code: public void stop() throws IllegalStateException {
          if (log.isDebugEnabled()) {
              log.debug("stop - subscriber stream state: {}", (subscriberStream != null ? subscriberStream.getState() : null));
          }
          // allow stop if playing or paused
          switch (subscriberStream.getState()) {
              case PLAYING:
              case PAUSED:
                  subscriberStream.setState(StreamState.STOPPED);
                  IMessageInput in = msgInReference.get();
                  if (in != null && !pullMode) {
                      in.unsubscribe(this);
                      msgInReference.set(null);
                  }
                  subscriberStream.onChange(StreamState.STOPPED, currentItem.get());
                  clearWaitJobs();
                  cancelDeferredStop();
                  if (subscriberStream instanceof IPlaylistSubscriberStream) {
                      IPlaylistSubscriberStream pss = (IPlaylistSubscriberStream) subscriberStream;
                      if (!pss.hasMoreItems()) {
                          releasePendingMessage();
                          sendCompleteStatus();
                          bytesSent.set(0);
                          sendStopStatus(currentItem.get());
                          sendClearPing();
                      } else {
                          if (lastMessageTs > 0) {
                              // remember last timestamp so we can generate correct headers in playlists.
                              timestampOffset = lastMessageTs;
                          }
                          pss.nextItem();
                      }
                  }
                  break;
              case CLOSED:
                  clearWaitJobs();
                  cancelDeferredStop();
                  break;
              case STOPPED:
                  log.trace("Already in stopped state");
                  break;
              default:
                  throw new IllegalStateException(String.format("Cannot stop in current state: %s", subscriberStream.getState()));
          }
      }
docs: Stop playback
  
  @throws IllegalStateException
  If stream is in stopped state