/** {@inheritDoc} */
 public void close() {
   if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
     stop();
   }
   if (msgOut != null) {
     msgOut.unsubscribe(this);
   }
   notifyBroadcastClose();
   setState(StreamState.CLOSED);
 }
 /**
  * Push message
  *
  * @param message Message
  */
 private void pushMessage(IMessage message) throws IOException {
   if (msgOut != null) {
     msgOut.pushMessage(message);
   }
   // Notify listeners about received packet
   if (message instanceof RTMPMessage) {
     final IRTMPEvent rtmpEvent = ((RTMPMessage) message).getBody();
     if (rtmpEvent instanceof IStreamPacket) {
       for (IStreamListener listener : getStreamListeners()) {
         try {
           listener.packetReceived(this, (IStreamPacket) rtmpEvent);
         } catch (Exception e) {
           log.error("Error while notifying listener " + listener, e);
         }
       }
     }
   }
 }