PURE_IMPORTS_START _ReplaySubject,_multicast PURE_IMPORTS_END
438433
function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) {
    if (selectorOrScheduler && typeof selectorOrScheduler !== 'function') {
        scheduler = selectorOrScheduler;
    }
    var selector = typeof selectorOrScheduler === 'function' ? selectorOrScheduler : undefined;
    var subject = new _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__["ReplaySubject"](bufferSize, windowTime, scheduler);
    return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(function () { return subject; }, selector)(source); };
}
921333
private void rebuildSubscriptionAndNotifyBusOfEffectiveImmediateChange(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final DefaultSubscriptionBase subscription,
                                                                           final SubscriptionBaseEvent immediateEvent, final int seqId, final Catalog catalog, final InternalCallContext context) {
        try {
            // We need to rehydrate the subscription, as some events might have been canceled on disk (e.g. future PHASE after while doing a change plan)
            final List<SubscriptionBaseEvent> activeSubscriptionEvents = getEventsForSubscriptionInTransaction(entitySqlDaoWrapperFactory, subscription.getId(), context);
            subscription.rebuildTransitions(activeSubscriptionEvents, catalog);
            notifyBusOfEffectiveImmediateChange(entitySqlDaoWrapperFactory, subscription, immediateEvent, seqId, context);
        } catch (final CatalogApiException e) {
            log.warn("Failed to post effective event for subscriptionId='{}'", subscription.getId(), e);
        }
    }
321983
function initReplay() {
  const replayOption = ['record', 'replay'].find(opt => program[opt] === true)
  if (replayOption) process.env.REPLAY = replayOption

  process.env.REPLAY =
    replayOption || (process.env.REPLAY ? process.env.REPLAY : 'bloody')

  if (process.env.REPLAY !== 'bloody') require('replay')
}
904994
function init(copyObject, cb) {
		var result = 0
		isError = false
		var cbCounter = 1
		for (var to in copyObject) {
			var o = copyObjects[copyObjectsIndex++] =
				new copyobject.CopyObject(copyObject[to], to, notifyFn)
			cbCounter++
			o.doCopy(copyResult)
		}
		copyResult()

		function copyResult(err, count) {
			if (!err) {
				if (count) result += count
				if (!--cbCounter && cb) cb(null, result)
			} else if (!isError) {
				isError = true
				if (cb) cb(err)
			}
		}
	}
143952
def fromimportupdate(cls, bundle, import_reg):
        # type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent
        
        exc = import_reg.get_exception()
        if exc:
            return RemoteServiceAdminEvent(
                RemoteServiceAdminEvent.IMPORT_ERROR,
                bundle,
                import_reg.get_import_container_id(),
                import_reg.get_remoteservice_id(),
                None,
                None,
                exc,
                import_reg.get_description(),
            )

        return RemoteServiceAdminEvent(
            RemoteServiceAdminEvent.IMPORT_UPDATE,
            bundle,
            import_reg.get_import_container_id(),
            import_reg.get_remoteservice_id(),
            import_reg.get_import_reference(),
            None,
            None,
            import_reg.get_description(),
        )
490455
protected void initBroadcastInputsSerializers(int numBroadcastInputs) throws Exception {
		this.broadcastInputSerializers = new TypeSerializerFactory[numBroadcastInputs];
		this.broadcastInputIterators = new MutableObjectIterator[numBroadcastInputs];

		for (int i = 0; i < numBroadcastInputs; i++) {
			//  ---------------- create the serializer first ---------------------
			final TypeSerializerFactory<?> serializerFactory = this.config.getBroadcastInputSerializer(i, this.userCodeClassLoader);
			this.broadcastInputSerializers[i] = serializerFactory;

			this.broadcastInputIterators[i] = createInputIterator(this.broadcastInputReaders[i], this.broadcastInputSerializers[i]);
		}
	}
865887
public int replay_completion() throws NotPrepared
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "replay_completion");

        int result = Status.STATUS_ROLLEDBACK;

        final int status = _transaction.getStatus();

        final int numberOfResources = _transaction.getResources().numRegistered();

        if (tc.isDebugEnabled())
            Tr.debug(tc, "replay_completion status:" + status);

        switch (status)
        {
        // If the transaction is still active, raise the NotPrepared exception.
        // The transaction must be marked rollback-only at this point because we
        // cannot allow the transaction to complete if a participant has failed.
            case javax.transaction.Status.STATUS_ACTIVE:
                try
                {
                    _transaction.setRollbackOnly();
                } catch (Throwable exc)
                {
                    FFDCFilter.processException(exc, "com.ibm.tx.remote.TransactionWrapper.replay_completion", "171", this);
                    if (tc.isEventEnabled())
                        Tr.event(tc, "replay_completion caught exception setting coordinator rollback_only", exc);
                }
            case javax.transaction.Status.STATUS_MARKED_ROLLBACK:
                final NotPrepared npe = new NotPrepared();
                if (tc.isEntryEnabled())
                    Tr.exit(tc, "replay_completion", npe);
                throw npe;

                // If the transaction is prepared, the caller must wait for the
                // Coordinator to tell it what to do, so return an unknown status, and
                // do nothing.  Note that if this Coordinator is sitting waiting for
                // its superior, this could take a long time.
            case javax.transaction.Status.STATUS_PREPARED:
                result = Status.STATUS_UNKNOWN;
                break;

            case javax.transaction.Status.STATUS_PREPARING:
                if (numberOfResources == 1)
                {
                    // There is only 1 resource registered and it is the caller so
                    // we will be issuing commit_one_phase to it, ie will have delegated
                    // responsibility to it to complete the txn, so we "no longer exist"
                    // as part of the transaction, so raise object_not_exist.
                    final OBJECT_NOT_EXIST one = new OBJECT_NOT_EXIST();
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "replay_completion", one);
                    throw one;
                }
                result = Status.STATUS_UNKNOWN;
                break;

            // If the transaction has been committed, the caller will receive a commit.
            case javax.transaction.Status.STATUS_COMMITTING:
                result = Status.STATUS_COMMITTING;
                break;

            case javax.transaction.Status.STATUS_COMMITTED:
                if (numberOfResources == 1)
                {
                    // There is only 1 resource registered and it is the caller so
                    // we have issued commit_one_phase to it, ie will have delegated
                    // responsibility to it to complete the txn, so we "no longer exist"
                    // as part of the transaction, so raise object_not_exist.
                    final OBJECT_NOT_EXIST one = new OBJECT_NOT_EXIST();
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "replay_completion", one);
                    throw one;
                }
                result = Status.STATUS_COMMITTED;
                break;

            case javax.transaction.Status.STATUS_NO_TRANSACTION:
                result = Status.STATUS_NO_TRANSACTION;
                break;

            case javax.transaction.Status.STATUS_ROLLEDBACK:
                if (numberOfResources == 1)
                {
                    // There is only 1 resource registered and it is the caller so
                    // we have issued commit_one_phase to it, ie will have delegated
                    // responsibility to it to complete the txn, so we "no longer exist"
                    // as part of the transaction, so raise object_not_exist.
                    final OBJECT_NOT_EXIST one = new OBJECT_NOT_EXIST();
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "replay_completion", one);
                    throw one;
                }

                // In any other situation, assume that the transaction has been rolled
                // back. As there is a Coordinator, it will direct the Resource to roll
                // back.
            default:
                result = Status.STATUS_ROLLEDBACK;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "replay_completion", result);
        return result;
    }
526447
function initScriptMode () {
		//buffer source node
		let bufferNode = context.createBufferSource()
		bufferNode.loop = true;
		bufferNode.buffer = util.create(samplesPerFrame, channels, {context: context})

		node = context.createScriptProcessor(samplesPerFrame)
		node.addEventListener('audioprocess', function (e) {
			//release causes synchronous pulling the pipeline
			//so that we get a new data chunk
			let cb = release;
			release = null;
			cb && cb()

			if (isStopped) return;

			util.copy(shift(e.inputBuffer.length), e.outputBuffer)
		})

		//start should be done after the connection, or there is a chance it won’t
		bufferNode.connect(node)
		bufferNode.start()

		return node;
	}
1040119
@Override
    public boolean replayCompletion(String globalId) {
        final DistributableTransaction tx = getTransactionForID(globalId);

        if (tx != null) {
            tx.replayCompletion();
            return true;
        }

        return false;

    }
1270094
function MediaObjectCreator(host, encodeCreate, encodeRpc, encodeTransaction,
  describe, strict) {
  if (!(this instanceof MediaObjectCreator))
    return new MediaObjectCreator(host, encodeCreate, encodeRpc,
      encodeTransaction, describe)

  /**
   * @param constructor
   *
   * @return {module:core/abstracts.MediaObject}
   */
  function createObject(constructor) {
    var mediaObject = new constructor(strict)

    mediaObject.on('_describe', describe);
    mediaObject.on('_rpc', encodeRpc);

    if (mediaObject instanceof register.abstracts['kurento.Hub'] ||
      mediaObject instanceof register
      .classes['kurento.MediaPipeline'])
      mediaObject.on('_create', encodeCreate);

    if (mediaObject instanceof register.classes['kurento.MediaPipeline'])
      mediaObject.on('_transaction', encodeTransaction);

    return mediaObject;
  };

  /**
   * Request to the server to create a new MediaElement
   *
   * @param item
   * @param {module:kurentoClient~MediaObjectCreator~createMediaObjectCallback} [callback]
   */
  function createMediaObject(item, callback) {
    var transaction = item.transaction;
    delete item.transaction;

    var constructor = createConstructor(item, strict);

    item = constructor.item;
    delete constructor.item;

    var params = item.params || {};
    delete item.params;

    if (params.mediaPipeline == undefined && host instanceof register.classes
      .MediaPipeline)
      params.mediaPipeline = host;

    var params_ = extend({}, params)
    item.constructorParams = checkParams(params_, constructor.constructorParams,
      item.type);

    if (Object.keys(params_)) {
      item.properties = params_;
    }

    if (!Object.keys(item.constructorParams).length)
      delete item.constructorParams;

    try {
      var mediaObject = createObject(constructor)
    } catch (error) {
      return callback(error)
    };

    Object.defineProperty(item, 'object', {
      value: mediaObject
    });

    encodeCreate(transaction, item, callback);

    return mediaObject
  };
  /**
   * @callback module:kurentoClient~MediaObjectCreator~createMediaObjectCallback
   * @param {external:Error} error
   */

  /**
   * @method module:kurentoClient~MediaObjectCreator#create
   *
   * @param type
   * @param params
   * @param {module:kurentoClient~MediaObjectCreator~createCallback} [callback]
   */
  this.create = function (type, params, callback) {
    var transaction = (arguments[0] instanceof Transaction) ? Array.prototype
      .shift.apply(arguments) : undefined;

    switch (arguments.length) {
    case 1:
      params = undefined;
    case 2:
      callback = undefined;
    };

    // Fix optional parameters
    if (params instanceof Function) {
      if (callback)
        throw new SyntaxError("Nothing can be defined after the callback");

      callback = params;
      params = undefined;
    };

    if (type instanceof Array) {
      var createPipeline = false

      type.forEach(function (request) {
        var params = request.params || {}

        if (typeof params.mediaPipeline === 'number')
          createPipeline = true
      })

      function connectElements(error, elements) {
        if (error) return callback(error)

        if (params === true && host.connect)
          return host.connect(elements.filter(function (element) {
              try {
                checkMediaElement(element)
                return true
              } catch (e) {}
            }),
            function (error) {
              if (error) return callback(error)

              callback(null, elements)
            })

        callback(null, elements)
      }

      if (createPipeline)
        return host.transaction(function () {
          var mediaObjects = []

          async.map(type, function (request, callback) {
              var params = request.params || {}

              if (typeof params.mediaPipeline === 'number')
                params.mediaPipeline = mediaObjects[params
                  .mediaPipeline]

              mediaObjects.push(createMediaObject(request, callback))
            },
            connectElements)
        })

      return createPromise(type, createMediaObject, connectElements)
    }

    type = {
      params: params,
      transaction: transaction,
      type: type
    };

    return createMediaObject(type, callback)
  };
  /**
   * @callback module:kurentoClient~MediaObjectCreator~createCallback
   *
   * @param {external:Error} error
   * @param {module:core/abstracts.MediaObject} mediaObject
   *  The created MediaObject
   */

  /**
   * @method module:kurentoClient~MediaObjectCreator#createInmediate
   *
   * @param item
   */
  this.createInmediate = function (item) {
    var constructor = createConstructor(item, strict);
    delete constructor.item;

    return createObject(constructor);
  }
}
826275
def _run(self):
        
        port = broadcast_port
        nameservers = []
        if self._multicast_enabled:
            recv = MulticastReceiver(port).settimeout(2.)
            while True:
                try:
                    recv = MulticastReceiver(port).settimeout(2.)
                    LOGGER.info("Receiver initialized.")
                    break
                except IOError as err:
                    if err.errno == errno.ENODEV:
                        LOGGER.error("Receiver initialization failed "
                                     "(no such device). "
                                     "Trying again in %d s",
                                     10)
                        time.sleep(10)
                    else:
                        raise
        else:
            recv = _SimpleReceiver(port)
            nameservers = ["localhost"]

        self._is_running = True
        with Publish("address_receiver", self._port, ["addresses"],
                     nameservers=nameservers) as pub:
            try:
                while self._do_run:
                    try:
                        data, fromaddr = recv()
                        LOGGER.debug("data %s", data)
                        del fromaddr
                    except SocketTimeout:
                        if self._multicast_enabled:
                            LOGGER.debug("Multicast socket timed out on recv!")
                            continue
                    finally:
                        self._check_age(pub, min_interval=self._max_age / 20)
                        if self._do_heartbeat:
                            pub.heartbeat(min_interval=29)
                    msg = Message.decode(data)
                    name = msg.subject.split("/")[1]
                    if(msg.type == 'info' and
                       msg.subject.lower().startswith(self._subject)):
                        addr = msg.data["URI"]
                        msg.data['status'] = True
                        metadata = copy.copy(msg.data)
                        metadata["name"] = name

                        LOGGER.debug('receiving address %s %s %s', str(addr),
                                     str(name), str(metadata))
                        if addr not in self._addresses:
                            LOGGER.info("nameserver: publish add '%s'",
                                        str(msg))
                            pub.send(msg.encode())
                        self._add(addr, metadata)
            finally:
                self._is_running = False
                recv.close()
1001599
function createMediaObject(item, callback) {
    var transaction = item.transaction;
    delete item.transaction;

    var constructor = createConstructor(item, strict);

    item = constructor.item;
    delete constructor.item;

    var params = item.params || {};
    delete item.params;

    if (params.mediaPipeline == undefined && host instanceof register.classes
      .MediaPipeline)
      params.mediaPipeline = host;

    var params_ = extend({}, params)
    item.constructorParams = checkParams(params_, constructor.constructorParams,
      item.type);

    if (Object.keys(params_)) {
      item.properties = params_;
    }

    if (!Object.keys(item.constructorParams).length)
      delete item.constructorParams;

    try {
      var mediaObject = createObject(constructor)
    } catch (error) {
      return callback(error)
    };

    Object.defineProperty(item, 'object', {
      value: mediaObject
    });

    encodeCreate(transaction, item, callback);

    return mediaObject
  }
128176
def send_local_subs_to_route
      ObjectSpace.each_object(NATSD::Connection) do |c|
        next if c.closing? || c.type != 'Client'
        c.subscriptions.each_value do |sub|
          queue_data(NATSD::Server.route_sub_proto(sub))
        end
      end
    end
479066
function () {
      var player = this;
      // This is the original normal protocol, used while in record mode but not recording.
      this.stopProtocol = this.controller.connection.protocol;

      // This consumes all frame data, making the device act as if not streaming
      this.playbackProtocol = function (data) {
        // The old protocol still needs to emit events, so we use it, but intercept Frames
        var eventOrFrame = player.stopProtocol(data);
        if (eventOrFrame instanceof Leap.Frame) {

          if (player.pauseOnHand) {
            if (data.hands.length > 0) {
              player.userHasControl = true;
              player.controller.emit('playback.userTakeControl');
              player.setGraphic();
              player.idle();
            } else if (data.hands.length == 0) {
              if (player.userHasControl && player.resumeOnHandLost) {
                player.userHasControl = false;
                player.controller.emit('playback.userReleaseControl');
                player.setGraphic('wave');
              }

            }
          }

          // prevent the actual frame from getting through
          return {type: 'playback'}
        } else {
          return eventOrFrame;
        }
      };

      // This pushes frame data, and watches for hands to auto change state.
      // Returns the eventOrFrame without modifying it.
      this.recordProtocol = function (data) {
        var eventOrFrame = player.stopProtocol(data);
        if (eventOrFrame instanceof Leap.Frame) {
          player.recordFrameHandler(data);
        }
        return eventOrFrame;
      };

      // Copy methods/properties from the default protocol over
      for (var property in this.stopProtocol) {
        if (this.stopProtocol.hasOwnProperty(property)) {
          this.playbackProtocol[property] = this.stopProtocol[property]
          this.recordProtocol[property] = this.stopProtocol[property]
        }
      }

      // todo: this is messy. Should cover all cases, not just active playback!
      if (this.state == 'playing') {
        this.controller.connection.protocol = this.playbackProtocol
      }
    }
1163492
def fromimportunreg(
        cls, bundle, cid, rsid, import_ref, exception, endpoint
    ):
        # type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ImportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
        
        return RemoteServiceAdminEvent(
            typ=RemoteServiceAdminEvent.IMPORT_UNREGISTRATION,
            bundle=bundle,
            cid=cid,
            rsid=rsid,
            import_ref=import_ref,
            exception=exception,
            endpoint=endpoint,
        )
595407
function multicast(subjectOrSubjectFactory, selector) {
    return function multicastOperatorFunction(source) {
        var subjectFactory;
        if (typeof subjectOrSubjectFactory === 'function') {
            subjectFactory = subjectOrSubjectFactory;
        }
        else {
            subjectFactory = function subjectFactory() {
                return subjectOrSubjectFactory;
            };
        }
        if (typeof selector === 'function') {
            return source.lift(new MulticastOperator(subjectFactory, selector));
        }
        var connectable = Object.create(source, _observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_0__["connectableObservableDescriptor"]);
        connectable.source = source;
        connectable.subjectFactory = subjectFactory;
        return connectable;
    };
}
955561
function () {
    var spectatorCameraEl = this.spectatorCameraEl;

    if (!spectatorCameraEl) {
      this.el.addEventListener('spectatorcameracreated',
                               bind(this.activateSpectatorCamera, this));
      return;
    }

    if (!spectatorCameraEl.hasLoaded) {
      spectatorCameraEl.addEventListener('loaded', bind(this.activateSpectatorCamera, this));
      return;
    }

    log('Activating spectator camera');
    spectatorCameraEl.setAttribute('camera', 'active', true);
    this.cameraEl.getObject3D('replayerMesh').visible = true;
  }