private void startInputProducerIfHasAttachedConsumers(TriState startedAsPrefetch) {
      BaseProducerContext multiplexProducerContext;
      ForwardingConsumer forwardingConsumer;
      synchronized (Multiplexer.this) {
        Preconditions.checkArgument(mMultiplexProducerContext == null);
        Preconditions.checkArgument(mForwardingConsumer == null);

        // Cleanup if all consumers have been cancelled before this method was called
        if (mConsumerContextPairs.isEmpty()) {
          removeMultiplexer(mKey, this);
          return;
        }

        ProducerContext producerContext = mConsumerContextPairs.iterator().next().second;
        mMultiplexProducerContext =
            new BaseProducerContext(
                producerContext.getImageRequest(),
                producerContext.getId(),
                producerContext.getProducerListener(),
                producerContext.getCallerContext(),
                producerContext.getLowestPermittedRequestLevel(),
                computeIsPrefetch(),
                computeIsIntermediateResultExpected(),
                computePriority(),
                producerContext.getImagePipelineConfig());
        mMultiplexProducerContext.putExtras(producerContext.getExtras());
        if (startedAsPrefetch.isSet()) {
          mMultiplexProducerContext.putExtra(
              EXTRAS_STARTED_AS_PREFETCH, startedAsPrefetch.asBoolean());
        }

        mForwardingConsumer = new ForwardingConsumer();
        multiplexProducerContext = mMultiplexProducerContext;
        forwardingConsumer = mForwardingConsumer;
      }
      mInputProducer.produceResults(forwardingConsumer, multiplexProducerContext);
    }
Starts next producer if it is not started yet and there is at least one Consumer waiting for
the data. If all consumers are cancelled, then this multiplexer is removed from mRequest map
to clean up.
imagepipeline/src/main/java/com/facebook/imagepipeline/producers/MultiplexProducer.java