Package com.google.android.exoplayer2.ext.vp9

## Class LibvpxVideoRenderer

- java.lang.Object
- - com.google.android.exoplayer2.BaseRenderer
  - - com.google.android.exoplayer2.video.DecoderVideoRenderer
    - - com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer

- All Implemented Interfaces:
    `PlayerMessage.Target`, `Renderer`, `RendererCapabilities`

      public class LibvpxVideoRenderer
      extends DecoderVideoRenderer

  Decodes and renders video using the native VP9 decoder.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Renderer

      `Renderer.State, Renderer.VideoScalingMode, Renderer.WakeupListener`

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.RendererCapabilities

      `RendererCapabilities.AdaptiveSupport, RendererCapabilities.Capabilities, RendererCapabilities.FormatSupport, RendererCapabilities.TunnelingSupport`

  - ### Field Summary

    - ### Fields inherited from class com.google.android.exoplayer2.video.DecoderVideoRenderer

      `decoderCounters`

    - ### Fields inherited from interface com.google.android.exoplayer2.Renderer

      `MSG_CUSTOM_BASE, MSG_SET_AUDIO_ATTRIBUTES, MSG_SET_AUDIO_SESSION_ID, MSG_SET_AUX_EFFECT_INFO, MSG_SET_CAMERA_MOTION_LISTENER, MSG_SET_SCALING_MODE, MSG_SET_SKIP_SILENCE_ENABLED, MSG_SET_VIDEO_FRAME_METADATA_LISTENER, MSG_SET_VIDEO_OUTPUT, MSG_SET_VOLUME, MSG_SET_WAKEUP_LISTENER, STATE_DISABLED, STATE_ENABLED, STATE_STARTED, VIDEO_SCALING_MODE_DEFAULT, VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING`

    - ### Fields inherited from interface com.google.android.exoplayer2.RendererCapabilities

      `ADAPTIVE_NOT_SEAMLESS, ADAPTIVE_NOT_SUPPORTED, ADAPTIVE_SEAMLESS, ADAPTIVE_SUPPORT_MASK, FORMAT_EXCEEDS_CAPABILITIES, FORMAT_HANDLED, FORMAT_SUPPORT_MASK, FORMAT_UNSUPPORTED_DRM, FORMAT_UNSUPPORTED_SUBTYPE, FORMAT_UNSUPPORTED_TYPE, TUNNELING_NOT_SUPPORTED, TUNNELING_SUPPORT_MASK, TUNNELING_SUPPORTED`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LibvpxVideoRenderer​(long allowedJoiningTimeMs)` | Creates a new instance.
    `LibvpxVideoRenderer​(long allowedJoiningTimeMs, Handler eventHandler, VideoRendererEventListener eventListener, int maxDroppedFramesToNotify)` | Creates a new instance.
    `LibvpxVideoRenderer​(long allowedJoiningTimeMs, Handler eventHandler, VideoRendererEventListener eventListener, int maxDroppedFramesToNotify, int threads, int numInputBuffers, int numOutputBuffers)` | Creates a new instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected DecoderReuseEvaluation` | `canReuseDecoder​(String decoderName, Format oldFormat, Format newFormat)` | Evaluates whether the existing decoder can be reused for a new `Format`.
    `protected VpxDecoder` | `createDecoder​(Format format, ExoMediaCrypto mediaCrypto)` | Creates a decoder for the given format.
    `String` | `getName()` | Returns the name of this renderer, for logging and debugging purposes.
    `protected void` | `renderOutputBufferToSurface​(VideoDecoderOutputBuffer outputBuffer, Surface surface)` | Renders the specified output buffer to the passed surface.
    `protected void` | `setDecoderOutputMode​(int outputMode)` | Sets output mode of the decoder.
    `int` | `supportsFormat​(Format format)` | Returns the extent to which the `Renderer` supports a given format.

    - ### Methods inherited from class com.google.android.exoplayer2.video.DecoderVideoRenderer

      `dropOutputBuffer, flushDecoder, handleMessage, isEnded, isReady, maybeDropBuffersToKeyframe, onDisabled, onEnabled, onInputFormatChanged, onPositionReset, onProcessedOutputBuffer, onQueueInputBuffer, onStarted, onStopped, onStreamChanged, releaseDecoder, render, renderOutputBuffer, setOutput, shouldDropBuffersToKeyframe, shouldDropOutputBuffer, shouldForceRenderOutputBuffer, skipOutputBuffer, updateDroppedBufferCounters`

    - ### Methods inherited from class com.google.android.exoplayer2.BaseRenderer

      `createRendererException, createRendererException, disable, enable, getCapabilities, getConfiguration, getFormatHolder, getIndex, getLastResetPositionUs, getMediaClock, getReadingPositionUs, getState, getStream, getStreamFormats, getTrackType, hasReadStreamToEnd, isCurrentStreamFinal, isSourceReady, maybeThrowStreamError, onReset, readSource, replaceStream, reset, resetPosition, setCurrentStreamFinal, setIndex, skipSource, start, stop, supportsMixedMimeTypeAdaptation`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.android.exoplayer2.Renderer

      `setPlaybackSpeed`

- - ### Constructor Detail

    - #### LibvpxVideoRenderer

          public LibvpxVideoRenderer​(long allowedJoiningTimeMs)

      Creates a new instance.
      Parameters:
        `allowedJoiningTimeMs` - The maximum duration in milliseconds for which this video renderer can attempt to seamlessly join an ongoing playback.

    - #### LibvpxVideoRenderer

          public LibvpxVideoRenderer​(long allowedJoiningTimeMs,
                                     @Nullable
                                     Handler eventHandler,
                                     @Nullable
                                     VideoRendererEventListener eventListener,
                                     int maxDroppedFramesToNotify)

      Creates a new instance.
      Parameters:
        `allowedJoiningTimeMs` - The maximum duration in milliseconds for which this video renderer can attempt to seamlessly join an ongoing playback.
        `eventHandler` - A handler to use when delivering events to `eventListener`. May be null if delivery of events is not required.
        `eventListener` - A listener of events. May be null if delivery of events is not required.
        `maxDroppedFramesToNotify` - The maximum number of frames that can be dropped between invocations of `VideoRendererEventListener.onDroppedFrames(int, long)`.

    - #### LibvpxVideoRenderer

          public LibvpxVideoRenderer​(long allowedJoiningTimeMs,
                                     @Nullable
                                     Handler eventHandler,
                                     @Nullable
                                     VideoRendererEventListener eventListener,
                                     int maxDroppedFramesToNotify,
                                     int threads,
                                     int numInputBuffers,
                                     int numOutputBuffers)

      Creates a new instance.
      Parameters:
        `allowedJoiningTimeMs` - The maximum duration in milliseconds for which this video renderer can attempt to seamlessly join an ongoing playback.
        `eventHandler` - A handler to use when delivering events to `eventListener`. May be null if delivery of events is not required.
        `eventListener` - A listener of events. May be null if delivery of events is not required.
        `maxDroppedFramesToNotify` - The maximum number of frames that can be dropped between invocations of `VideoRendererEventListener.onDroppedFrames(int, long)`.
        `threads` - Number of threads libvpx will use to decode.
        `numInputBuffers` - Number of input buffers.
        `numOutputBuffers` - Number of output buffers.

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `Renderer`
      Returns the name of this renderer, for logging and debugging purposes. Should typically be the renderer's (un-obfuscated) class name.
      Returns:
        The name of this renderer.

    - #### supportsFormat

          @Capabilities
          public final int supportsFormat​(Format format)

      Description copied from interface: `RendererCapabilities`
      Returns the extent to which the `Renderer` supports a given format.
      Parameters:
        `format` - The format.
      Returns:
        The `RendererCapabilities.Capabilities` for this format.

    - #### createDecoder

          protected VpxDecoder createDecoder​(Format format,
                                             @Nullable
                                             ExoMediaCrypto mediaCrypto)
                                      throws VpxDecoderException

      Description copied from class: `DecoderVideoRenderer`
      Creates a decoder for the given format.
      Specified by:
        `createDecoder` in class `DecoderVideoRenderer`
      Parameters:
        `format` - The format for which a decoder is required.
        `mediaCrypto` - The `ExoMediaCrypto` object required for decoding encrypted content. May be null and can be ignored if decoder does not handle encrypted content.
      Returns:
        The decoder.
      Throws:
        `VpxDecoderException`

    - #### renderOutputBufferToSurface

          protected void renderOutputBufferToSurface​(VideoDecoderOutputBuffer outputBuffer,
                                                     Surface surface)
                                              throws VpxDecoderException

      Description copied from class: `DecoderVideoRenderer`
      Renders the specified output buffer to the passed surface.

      The implementation of this method takes ownership of the output buffer and is responsible for calling `VideoDecoderOutputBuffer.release()` either immediately or in the future.

      Specified by:
        `renderOutputBufferToSurface` in class `DecoderVideoRenderer`
      Parameters:
        `outputBuffer` - `VideoDecoderOutputBuffer` to render.
        `surface` - Output `Surface`.
      Throws:
        `VpxDecoderException`

    - #### setDecoderOutputMode

          protected void setDecoderOutputMode​(@VideoOutputMode
                                              int outputMode)

      Description copied from class: `DecoderVideoRenderer`
      Sets output mode of the decoder.
      Specified by:
        `setDecoderOutputMode` in class `DecoderVideoRenderer`
      Parameters:
        `outputMode` - Output mode.

    - #### canReuseDecoder

          protected DecoderReuseEvaluation canReuseDecoder​(String decoderName,
                                                           Format oldFormat,
                                                           Format newFormat)

      Description copied from class: `DecoderVideoRenderer`
      Evaluates whether the existing decoder can be reused for a new `Format`.

      The default implementation does not allow decoder reuse.

      Overrides:
        `canReuseDecoder` in class `DecoderVideoRenderer`
        `oldFormat` - The previous format.
        `newFormat` - The new format.
      Returns:
        The result of the evaluation.