mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Report audio decoder adaptation support correctly
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=144219518
This commit is contained in:
parent
2906a2ea09
commit
3547c9034e
4 changed files with 27 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ package com.google.android.exoplayer2.ext.ffmpeg;
|
|||
|
||||
import android.os.Handler;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.audio.AudioCapabilities;
|
||||
import com.google.android.exoplayer2.audio.AudioRendererEventListener;
|
||||
|
|
@ -60,7 +61,7 @@ public final class FfmpegAudioRenderer extends SimpleDecoderAudioRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int supportsFormat(Format format) {
|
||||
protected int supportsFormatInternal(Format format) {
|
||||
if (!FfmpegLibrary.isAvailable()) {
|
||||
return FORMAT_UNSUPPORTED_TYPE;
|
||||
}
|
||||
|
|
@ -69,6 +70,11 @@ public final class FfmpegAudioRenderer extends SimpleDecoderAudioRenderer {
|
|||
: MimeTypes.isAudio(mimeType) ? FORMAT_UNSUPPORTED_SUBTYPE : FORMAT_UNSUPPORTED_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int supportsMixedMimeTypeAdaptation() throws ExoPlaybackException {
|
||||
return ADAPTIVE_NOT_SEAMLESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FfmpegDecoder createDecoder(Format format, ExoMediaCrypto mediaCrypto)
|
||||
throws FfmpegDecoderException {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class LibflacAudioRenderer extends SimpleDecoderAudioRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int supportsFormat(Format format) {
|
||||
protected int supportsFormatInternal(Format format) {
|
||||
return FlacLibrary.isAvailable() && MimeTypes.AUDIO_FLAC.equalsIgnoreCase(format.sampleMimeType)
|
||||
? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public final class LibopusAudioRenderer extends SimpleDecoderAudioRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int supportsFormat(Format format) {
|
||||
protected int supportsFormatInternal(Format format) {
|
||||
return OpusLibrary.isAvailable() && MimeTypes.AUDIO_OPUS.equalsIgnoreCase(format.sampleMimeType)
|
||||
? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,24 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int supportsFormat(Format format) {
|
||||
int formatSupport = supportsFormatInternal(format);
|
||||
if (formatSupport == FORMAT_UNSUPPORTED_TYPE || formatSupport == FORMAT_UNSUPPORTED_SUBTYPE) {
|
||||
return formatSupport;
|
||||
}
|
||||
return ADAPTIVE_NOT_SEAMLESS | formatSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link #FORMAT_SUPPORT_MASK} component of the return value for
|
||||
* {@link #supportsFormat(Format)}.
|
||||
*
|
||||
* @param format The format.
|
||||
* @return The extent to which the renderer supports the format itself.
|
||||
*/
|
||||
protected abstract int supportsFormatInternal(Format format);
|
||||
|
||||
@Override
|
||||
public void render(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException {
|
||||
if (outputStreamEnded) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue