Class FakeSampleStream

    • Method Detail

      • writeData

        public void writeData​(long startPositionUs)
        Writes all not yet written sample stream items to the sample queue starting at the given position.
        Parameters:
        startPositionUs - The start position, in microseconds.
      • seekToUs

        public boolean seekToUs​(long positionUs,
                                boolean allowTimeBeyondBuffer)
        Seeks the stream to a new position using already available data in the queue.
        Parameters:
        positionUs - The new position, in microseconds.
        allowTimeBeyondBuffer - Whether the operation can succeed if timeUs is beyond the end of the queue, by seeking to the last sample (or keyframe).
        Returns:
        Whether seeking inside the available data was possible.
      • reset

        public void reset()
        Resets the sample queue.

        A new call to writeData(long) is required to fill the queue again.

      • isLoadingFinished

        public boolean isLoadingFinished()
        Returns whether data has been written to the sample queue until the end of stream signal.
      • getLargestQueuedTimestampUs

        public long getLargestQueuedTimestampUs()
        Returns the timestamp of the largest queued sample in the queue, or Long.MIN_VALUE if no samples are queued.
      • discardTo

        public void discardTo​(long positionUs,
                              boolean toKeyframe)
        Discards data from the queue.
        Parameters:
        positionUs - The position to discard to, in microseconds.
        toKeyframe - Whether to discard to keyframes only.
      • release

        public void release()
        Release the stream and its underlying sample queue.
      • maybeThrowError

        public void maybeThrowError()
                             throws IOException
        Description copied from interface: SampleStream
        Throws an error that's preventing data from being read. Does nothing if no such error exists.
        Specified by:
        maybeThrowError in interface SampleStream
        Throws:
        IOException - The underlying error.
      • skipData

        public int skipData​(long positionUs)
        Description copied from interface: SampleStream
        Attempts to skip to the keyframe before the specified position, or to the end of the stream if positionUs is beyond it.
        Specified by:
        skipData in interface SampleStream
        Parameters:
        positionUs - The specified time.
        Returns:
        The number of samples that were skipped.