Merge "Disable transcoding by default if no HEVC support"
This commit is contained in:
@@ -75,6 +75,9 @@ import android.content.pm.ProviderInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.ObbInfo;
|
||||
import android.database.ContentObserver;
|
||||
import android.media.MediaCodecList;
|
||||
import android.media.MediaCodecInfo;
|
||||
import android.media.MediaFormat;
|
||||
import android.net.Uri;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Binder;
|
||||
@@ -1006,10 +1009,27 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHevcDecoderSupported() {
|
||||
MediaCodecList codecList = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
|
||||
MediaCodecInfo[] codecInfos = codecList.getCodecInfos();
|
||||
for (MediaCodecInfo codecInfo : codecInfos) {
|
||||
if (codecInfo.isEncoder()) {
|
||||
continue;
|
||||
}
|
||||
String[] supportedTypes = codecInfo.getSupportedTypes();
|
||||
for (String type : supportedTypes) {
|
||||
if (type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_HEVC)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void configureTranscoding() {
|
||||
// See MediaProvider TranscodeHelper#getBooleanProperty for more information
|
||||
boolean transcodeEnabled = false;
|
||||
boolean defaultValue = true;
|
||||
boolean defaultValue = isHevcDecoderSupported() ? true : false;
|
||||
|
||||
if (SystemProperties.getBoolean("persist.sys.fuse.transcode_user_control", false)) {
|
||||
transcodeEnabled = SystemProperties.getBoolean("persist.sys.fuse.transcode_enabled",
|
||||
|
||||
Reference in New Issue
Block a user