Package org.red5.server.api

Examples of org.red5.server.api.IBWControllable


    public void onStreamEvent( Notify notify ) {

        //logger.debug( "onStreamEvent " + notify );

        ObjectMap map = (ObjectMap) notify.getCall().getArguments()[ 0 ];
        String code = (String) map.get( "code" );

        if ( StatusCodes.NS_PUBLISH_START.equals( code ) ) {
            //logger.debug( "onStreamEvent Publish start" );
            startPublish = true;
        }
View Full Code Here


    ScreenShare.instance.vScreenIconDown.addMouseListener(heightMouseListener);
    ScreenShare.instance.vScreenIconDown.addMouseMotionListener(heightMouseListener);
    ScreenShare.instance.t.add(ScreenShare.instance.vScreenIconDown);


    ScreenShare.instance.virtualScreen = new BlankArea(new Color(255,255,255,100));
    ScreenShare.instance.virtualScreen.setOpaque(true);
    ScreenShare.instance.virtualScreen.setHorizontalAlignment(SwingConstants.LEFT);
    ScreenShare.instance.virtualScreen.setVerticalAlignment(SwingConstants.TOP);
    ScreenShare.instance.virtualScreen.setText(VirtualScreenBean.screenWidthMax+":"+VirtualScreenBean.screenHeightMax);
    ScreenShare.instance.virtualScreen.setBounds(30, 170, VirtualScreenBean.vScreenWidth, VirtualScreenBean.vScreenHeight);
View Full Code Here

    ScreenShareRTMPT.instance.vScreenIconDown.addMouseListener(heightMouseListener);
    ScreenShareRTMPT.instance.vScreenIconDown.addMouseMotionListener(heightMouseListener);
    ScreenShareRTMPT.instance.t.add(ScreenShareRTMPT.instance.vScreenIconDown);


    ScreenShareRTMPT.instance.virtualScreen = new BlankArea(new Color(255,255,255,100));
    ScreenShareRTMPT.instance.virtualScreen.setOpaque(true);
    ScreenShareRTMPT.instance.virtualScreen.setHorizontalAlignment(SwingConstants.LEFT);
    ScreenShareRTMPT.instance.virtualScreen.setVerticalAlignment(SwingConstants.TOP);
    ScreenShareRTMPT.instance.virtualScreen.setText(VirtualScreenBean.screenWidthMax+":"+VirtualScreenBean.screenHeightMax);
    ScreenShareRTMPT.instance.virtualScreen.setBounds(30, 170, VirtualScreenBean.vScreenWidth, VirtualScreenBean.vScreenHeight);
View Full Code Here

                        stopButton.setBounds(290, 34, 200, 32);
                        stopButton.setEnabled(false);
                        t.add(stopButton);

                        //add the small screen thumb to the JFrame
                        new VirtualScreen();
                       
                        //*****
                        //Text Recording
                        textAreaHeaderRecording = new JLabel();
                       
View Full Code Here

      stopButton.setBounds(290, 34, 200, 32);
      stopButton.setEnabled(false);
      t.add(stopButton);

      //add the small screen thumb to the JFrame
      new VirtualScreen();
     
      //*****
      //Text Recording
      textAreaHeaderRecording = new JLabel();
     
View Full Code Here

      } else {
        oobCtrlMsg.setResult((long) 0);
      }
    } else if ("writeDelta".equals(oobCtrlMsg.getServiceName())) {
      long maxStream = 0;
      IBWControllable bwControllable = conn;
      // Search FC containing valid BWC
      while (bwControllable != null && bwControllable.getBandwidthConfigure() == null) {
        bwControllable = bwControllable.getParentBWControllable();
      }
      if (bwControllable != null && bwControllable.getBandwidthConfigure() != null) {
        IBandwidthConfigure bwc = bwControllable.getBandwidthConfigure();
        if (bwc instanceof IConnectionBWConfig) {
          maxStream = ((IConnectionBWConfig) bwc).getDownstreamBandwidth() / 8;
        }
      }
      if (maxStream <= 0) {
View Full Code Here

  }

  public void updateBWConfigure(IBWControlContext context) {
    if (!(context instanceof BWContext)) return;
    BWContext c = (BWContext) context;
    IBWControllable bc = c.getBWControllable();
    synchronized (c) {
      if (bc.getBandwidthConfigure() == null) {
        c.bwConfig = null;
        c.lastSchedule = -1;
      } else {
        long[] oldConfig = c.bwConfig;
        c.bwConfig = new long[4];
        for (int i = 0; i < 4; i++) {
          c.bwConfig[i] = bc.getBandwidthConfigure().getChannelBandwidth()[i];
        }
        if (oldConfig == null) {
          // initialize the last schedule timestamp if necessary
          c.lastSchedule = System.currentTimeMillis();
          long[] channelInitialBurst = bc.getBandwidthConfigure().getChannelInitialBurst();
          // set the initial value to token resources as "defaultCapacity/2"
          for (int i = 0; i < 4; i++) {
            if (channelInitialBurst[i] >= 0) {
              c.tokenRc[i] = channelInitialBurst[i];
            } else {
View Full Code Here

  public void setDefaultCapacity(long capacity) {
    this.defaultCapacity = capacity;
  }
 
  protected boolean processRequest(TokenRequest request) {
    IBWControllable bc = request.initialBC;
    while (bc != null) {
      BWContext context = contextMap.get(bc);
      if (context == null) {
        rollbackRequest(request);
        return false;
      }
      synchronized (context) {
        if (context.bwConfig != null) {
          boolean result;
          if (request.type == TokenRequestType.BLOCKING) {
            result = processBlockingRequest(request, context);
          } else if (request.type == TokenRequestType.NONBLOCKING) {
            result = processNonblockingRequest(request, context);
          } else {
            result = processBestEffortRequest(request, context);
          }
          if (!result) {
            // for non-blocking mode, the callback is
            // recorded and will be rolled back when being reset,
            // so we don't need to do rollback here.
            if (request.type != TokenRequestType.NONBLOCKING) {
              rollbackRequest(request);
            }
            return false;
          }
        }
        TokenRequestContext requestContext = new TokenRequestContext();
        requestContext.acquiredToken = request.requestToken;
        requestContext.bc = bc;
        request.acquiredStack.push(requestContext);
      }
      bc = bc.getParentBWControllable();
    }
    // for best effort request, we need to rollback over-charged tokens
    if (request.type == TokenRequestType.BEST_EFFORT) {
      rollbackRequest(request);
    }
View Full Code Here

    for (int i = 0; i < 3; i++) {
      List<TokenRequest> pendingList = context.pendingRequestArray[i];
      if (!pendingList.isEmpty()) {
        // loop through all pending requests in a channel
        for (TokenRequest request : pendingList) {
          IBWControllable bc = context.getBWControllable();
          while (bc != null) {
            BWContext c = contextMap.get(bc);
            if (c == null) {
              // context has been unregistered, we should ignore
              // this callback
              break;
            }
            synchronized (c) {
              if (c.bwConfig != null && !processNonblockingRequest(request, c)) {
                break;
              }
            }
            TokenRequestContext requestContext = new TokenRequestContext();
            requestContext.acquiredToken = request.requestToken;
            requestContext.bc = bc;
            request.acquiredStack.push(requestContext);
            bc = bc.getParentBWControllable();
          }
          if (bc == null) {
            // successfully got the required tokens
            try {
              request.callback.available(context.buckets[request.channel], (long) request.requestToken);
View Full Code Here

      }
    }

    public void reset() {
      // TODO wake up all blocked threads
      IBWControllable bc = this.bc;
      while (bc != null) {
        BWContext context = contextMap.get(bc);
        if (context == null) {
          break;
        }
        synchronized (context) {
          List<TokenRequest> pendingList = context.pendingRequestArray[channel];
          TokenRequest toRemove = null;
          for (TokenRequest request : pendingList) {
            if (request.initialBC == this.bc) {
              rollbackRequest(request);
              toRemove = request;
              break;
            }
          }
          if (toRemove != null) {
            pendingList.remove(toRemove);
            try {
              toRemove.callback.reset(this, (long) toRemove.requestToken);
            } catch (Throwable t) {
              log.error("Error reset request's callback", t);
            }
            break;
          }
        }
        bc = bc.getParentBWControllable();
      }
    }
View Full Code Here

TOP

Related Classes of org.red5.server.api.IBWControllable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.