Disable transcoding by default if no HEVC support
This patch by default disables transcoding if HEVC decoder is not supported. It may still be enabled/disabled via persistet properties and/or device_config settings. Bug: 270324498 Bug: 270320827 Test: run cts -m CtsMediaProviderTranscodeTests Test: run cts -m CtsMediaTranscodingTestCases Change-Id: I63ac7f4dd5103bea3f67a491a3fe030bafce075c Signed-off-by: Slawomir Rosek <srosek@google.com>
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