Exemplo n.º 1
0
 /** {@inheritDoc} */
 public boolean unregisterBroadcastStream(IScope scope, String name, IBroadcastStream bs) {
   if (log.isDebugEnabled()) {
     log.debug("Unregistering - name: {} stream: {} scope: {}", new Object[] {name, bs, scope});
     ((Scope) scope).dump();
   }
   IBroadcastScope broadcastScope = scope.getBroadcastScope(name);
   if (bs != null) {
     log.debug("Unsubscribing scope {} from provider {}", broadcastScope, bs.getProvider());
     broadcastScope.unsubscribe(bs.getProvider());
   }
   // if the scope has no listeners try to remove it
   if (!((BasicScope) broadcastScope).hasEventListeners()) {
     if (log.isDebugEnabled()) {
       log.debug("Scope has no event listeners attempting removal");
     }
     scope.removeChildScope(broadcastScope);
   }
   // verify that scope was removed
   return scope.getBasicScope(ScopeType.BROADCAST, name) == null;
 }
 /** {@inheritDoc} */
 public void publish(Boolean dontStop) {
   if (!dontStop) {
     IConnection conn = Red5.getConnectionLocal();
     if (conn instanceof IStreamCapableConnection) {
       IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
       int streamId = conn.getStreamId();
       IClientStream stream = streamConn.getStreamById(streamId);
       if (stream instanceof IBroadcastStream) {
         IBroadcastStream bs = (IBroadcastStream) stream;
         if (bs.getPublishedName() != null) {
           IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
           if (bsScope != null) {
             bsScope.unsubscribe(bs.getProvider());
             if (conn instanceof BaseConnection) {
               ((BaseConnection) conn).unregisterBasicScope(bsScope);
             }
           }
           bs.close();
           streamConn.deleteStreamById(streamId);
         }
       }
     }
   }
 }