Skip to content

Instantly share code, notes, and snippets.

@a-chernykh
Created June 28, 2014 10:03
Show Gist options
  • Save a-chernykh/0c2b1b19083ad6b3df78 to your computer and use it in GitHub Desktop.
Save a-chernykh/0c2b1b19083ad6b3df78 to your computer and use it in GitHub Desktop.
MediaCodecFormatSelector
public class MediaCodecFormatSelector {
public static MediaCodecFormatSelector forDevice() {
String deviceName = Device.getDeviceName();
if (deviceName.equalsIgnoreCase("samsung gt-i9300")
&& isBadMediaCodecSupport()) {
return new SamsungGalaxyS3MediaCodecFormatSelector();
else if (isBadMediaCodecSupport() && isAffectedDevice(deviceName)) {
return new NoMediaCodecSupportFormatSelector();
} else {
return new MediaCodecFormatSelector();
}
}
private static boolean isBadMediaCodecSupport() {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment