Optionally fall back to other decoders if init fails
Codec initialization may fail in creation, configuration or when start()ing the codec. If codec initialization fails, there may be other codecs available that could handle the same format, but currently ExoPlayer can only try to use the first listed codec for the input format and gives up if it fails to initialize. This change implements support for optionally falling back to alternative decoders if initialization fails. MediaCodecSelector can now return a list of decoders to try in priority order, and use the Format when choosing a codec. With the default implementation, the codecs and order come from MediaCodecList, and matches the order used internally by MediaCodec.createDecoderByType (which implements the same kind of fallback though only to the creation step, without configuring/starting the codec). This feature is useful for apps that want to play several videos concurrently on devices that have software decoders (like OMX.google.h264.decoder), as the new behavior allows new codecs to be created when no hardware-accelerated decoders are available. The list of available codecs is queried when initializing the codec after a format change that requires a new codec to be instantiated. When a decoder fails to initialize it is removed from the list of available decoders and won't be tried again until the next format change (or until the renderer is disabled). Note: this change does not affect the renderer capabilities API, as when checking format support we don't know which codec will be used. Issue: #273 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=203242285
Showing
with
93 additions
and
40 deletions
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment