Display an error dialog if we can't find an H.264 decoder

This commit is contained in:
Cameron Gutman 2015-12-16 18:30:53 -08:00
parent 9bb91e1085
commit 3b1fcdfb10
3 changed files with 18 additions and 0 deletions

View File

@ -204,6 +204,18 @@ public class Game extends Activity implements SurfaceHolder.Callback,
if (prefConfig.videoFormat == PreferenceConfiguration.FORCE_H265_ON && !decoderRenderer.isHevcSupported()) {
Toast.makeText(this, "No H.265 decoder found.\nFalling back to H.264.", Toast.LENGTH_LONG).show();
}
if (!decoderRenderer.isAvcSupported()) {
if (spinner != null) {
spinner.dismiss();
spinner = null;
}
// If we can't find an AVC decoder, we can't proceed
Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title),
"This device or ROM doesn't support hardware accelerated H.264 playback.", true);
return;
}
StreamConfiguration config = new StreamConfiguration.Builder()
.setResolution(prefConfig.width, prefConfig.height)

View File

@ -4,4 +4,5 @@ import com.limelight.nvstream.av.video.VideoDecoderRenderer;
public abstract class EnhancedDecoderRenderer extends VideoDecoderRenderer {
public abstract boolean isHevcSupported();
public abstract boolean isAvcSupported();
}

View File

@ -116,6 +116,11 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
return hevcDecoderName != null;
}
@Override
public boolean isAvcSupported() {
return avcDecoderName != null;
}
@Override
public boolean setup(VideoDecoderRenderer.VideoFormat format, int width, int height, int redrawRate, Object renderTarget, int drFlags) {
this.initialWidth = width;