class ScheduledVideoContentHandlerWrapper implements VideoContentHandler<T>, Runnable {

    @Override
    public synchronized void handleContent(T content, long ptsMillis)
    {
        if (myClosed || ptsMillis < 0)
        {
            if (content instanceof AutoCloseable)
            {
                Utilities.close((AutoCloseable)content);
            }
            return;
        }
        if (myFirstNanoTime == NO_VALUE)
        {
            myFirstNanoTime = System.nanoTime();
        }
        if (myReferencePtsMillis == NO_VALUE)
        {
            myReferencePtsMillis = ptsMillis;
        }

        long ptsOffsetMillis = ptsMillis - myReferencePtsMillis;
        TimestampedContent<T> timestamped = new TimestampedContent<>(content,
                myReferenceTime.plus(new Milliseconds(ptsOffsetMillis)), ptsMillis);
        if (timestamped.getTimestamp().minus(TimeInstant.get()).isLessThan(MAX_SLEEP))
        {
            if (LOGGER.isDebugEnabled())
            {
                LOGGER.debug("Queuing content " + timestamped);
            }
            myContentQueue.offer(timestamped);
            kickQueue();
        }
        else if (timestamped.getContent() != null)
        {
            LOGGER.warn("Skipping future content for " + timestamped);
            if (content instanceof AutoCloseable)
            {
                Utilities.close((AutoCloseable)content);
            }
        }
    }

    public  ScheduledVideoContentHandlerWrapper(VideoContentHandler<? super T> videoContentHandler, long referencePtsMillis,
            TimeInstant referenceTime, ReadOnlyProperty<TimeInstant> handleTime);

}