Fix broken video on Galaxy S5 and Note III

This commit is contained in:
Cameron Gutman 2015-12-17 03:35:39 -08:00
parent ed8305b199
commit ab8779086b
2 changed files with 28 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import com.limelight.binding.input.evdev.EvdevListener;
import com.limelight.binding.input.evdev.EvdevWatcher;
import com.limelight.binding.video.EnhancedDecoderRenderer;
import com.limelight.binding.video.MediaCodecDecoderRenderer;
import com.limelight.binding.video.MediaCodecHelper;
import com.limelight.nvstream.NvConnection;
import com.limelight.nvstream.NvConnectionListener;
import com.limelight.nvstream.StreamConfiguration;
@ -198,6 +199,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
return;
}
// Initialize the MediaCodec helper before creating the decoder
MediaCodecHelper.initializeWithContext(this);
decoderRenderer = new MediaCodecDecoderRenderer(prefConfig.videoFormat);
// Display a message to the user if H.265 was forced on but we still didn't find a decoder

View File

@ -10,6 +10,9 @@ import java.util.Locale;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.media.MediaCodecInfo.CodecCapabilities;
@ -76,11 +79,31 @@ public class MediaCodecHelper {
whitelistedHevcDecoders = new LinkedList<>();
whitelistedHevcDecoders.add("omx.exynos");
whitelistedHevcDecoders.add("omx.qcom");
whitelistedHevcDecoders.add("omx.nvidia");
whitelistedHevcDecoders.add("omx.mtk");
whitelistedHevcDecoders.add("omx.amlogic");
whitelistedHevcDecoders.add("omx.rk");
// omx.qcom added conditionally during initialization
}
public static void initializeWithContext(Context context) {
ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo();
if (configInfo.reqGlEsVersion != ConfigurationInfo.GL_ES_VERSION_UNDEFINED) {
// Qualcomm's early HEVC decoders break hard on our HEVC stream. The best check to
// tell the good from the bad decoders are the generation of Adreno GPU included:
// 3xx - bad
// 4xx - good
//
// Unfortunately, it's not that easy to get that information here, so I'll use an
// approximation by checking the GLES level (<= 3.0 is bad).
LimeLog.info("OpenGL ES version: "+configInfo.reqGlEsVersion);
if (configInfo.reqGlEsVersion > 0x30000) {
LimeLog.info("Added omx.qcom to supported decoders based on GLES 3.1+ support");
whitelistedHevcDecoders.add("omx.qcom");
}
}
}
private static boolean isDecoderInList(List<String> decoderList, String decoderName) {