[hw-codec] Move media profile configs into data partition.
This will enable us to dynamically change the media_codecs_google_video.xml being
used, so we can run tests on different profiles.
If the emulator does not support this configurable
media_codecs_google_video.xml
mode, it will simply fall back to the
media_codecs_google_video_default.xml, which is the one we currently are
using at the moment.
Test: Manual.
1) Boot emulator without DynamicMediaProfile feature support. There
should be a symbolic link from
/data/vendor/etc/media_codecs_google_video_default.xml ->
/data/vendor/etc/media_codecs_google_video.xml
2) Boot emulator with DynamicMediaProfile feature support, but with
display resolution < 1080p (1920x1080). The result should be the same as 1).
3) Boot emulator as in 2), but with display resolution > 1080p.
The symbolic link should now be
/data/vendor/etc/media_codecs_google_video_v2.xml ->
/data/vendor/etc/media_codecs_google_video.xml
Change-Id: I17befc1949bc509cf4f45c7ebd29696f37d4f48b
diff --git a/camera/Android.mk b/camera/Android.mk
index 088af56..59102e2 100644
--- a/camera/Android.mk
+++ b/camera/Android.mk
@@ -122,6 +122,8 @@
LOCAL_MODULE := camera.ranchu
+# Symlink media profile configurations from /vendor/etc to /data/vendor/etc/
+LOCAL_POST_INSTALL_CMD := ln -sf /data/vendor/etc/media_codecs_google_video.xml $(PRODUCT_OUT)/vendor/etc/media_codecs_google_video.xml
include $(BUILD_SHARED_LIBRARY)
# Build all subdirectories #####################################################
diff --git a/camera/media_codecs_google_video.xml b/camera/media_codecs_google_video_default.xml
similarity index 100%
rename from camera/media_codecs_google_video.xml
rename to camera/media_codecs_google_video_default.xml
diff --git a/camera/media_codecs_google_video_v2.xml b/camera/media_codecs_google_video_v2.xml
new file mode 100644
index 0000000..6faf4dd
--- /dev/null
+++ b/camera/media_codecs_google_video_v2.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<Included>
+ <Decoders>
+ <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es">
+ <!-- profiles and levels: ProfileSimple : Level3 -->
+ <Limit name="size" min="2x2" max="352x288" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="blocks-per-second" range="12-11880" />
+ <Limit name="bitrate" range="1-384000" />
+ <Feature name="adaptive-playback" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp">
+ <!-- profiles and levels: ProfileBaseline : Level30, ProfileBaseline : Level45
+ ProfileISWV2 : Level30, ProfileISWV2 : Level45 -->
+ <Limit name="size" min="2x2" max="352x288" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="bitrate" range="1-384000" />
+ <Feature name="adaptive-playback" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.goldfish.h264.decoder" type="video/avc">
+ <!-- profiles and levels: ProfileHigh : Level52 -->
+ <Limit name="size" min="2x2" max="4080x4080" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-32768" /> <!-- max 4096x2048 equivalent -->
+ <Limit name="blocks-per-second" range="1-1966080" />
+ <Limit name="bitrate" range="1-48000000" />
+ <Feature name="adaptive-playback" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.hevc.decoder" type="video/hevc">
+ <!-- profiles and levels: ProfileMain : MainTierLevel51 -->
+ <Limit name="size" min="2x2" max="4096x4096" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="8x8" />
+ <Limit name="block-count" range="1-196608" /> <!-- max 4096x3072 -->
+ <Limit name="blocks-per-second" range="1-2000000" />
+ <Limit name="bitrate" range="1-10000000" />
+ <Feature name="adaptive-playback" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.goldfish.vp8.decoder" type="video/x-vnd.on2.vp8">
+ <Limit name="size" min="2x2" max="2048x2048" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-16384" />
+ <Limit name="blocks-per-second" range="1-1000000" />
+ <Limit name="bitrate" range="1-40000000" />
+ <Feature name="adaptive-playback" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.goldfish.vp9.decoder" type="video/x-vnd.on2.vp9">
+ <Limit name="size" min="2x2" max="2048x2048" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-16384" />
+ <Limit name="blocks-per-second" range="1-500000" />
+ <Limit name="bitrate" range="1-40000000" />
+ <Feature name="adaptive-playback" />
+ </MediaCodec>
+ </Decoders>
+
+ <Encoders>
+ <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp">
+ <!-- profiles and levels: ProfileBaseline : Level45 -->
+ <Limit name="size" min="176x144" max="176x144" />
+ <Limit name="alignment" value="16x16" />
+ <Limit name="bitrate" range="1-128000" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.h264.encoder" type="video/avc">
+ <!-- profiles and levels: ProfileBaseline : Level41 -->
+ <Limit name="size" min="16x16" max="2048x2048" />
+ <Limit name="alignment" value="2x2" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="block-count" range="1-8192" /> <!-- max 2048x1024 -->
+ <Limit name="blocks-per-second" range="1-245760" />
+ <Limit name="bitrate" range="1-12000000" />
+ <Feature name="intra-refresh" />
+ </MediaCodec>
+ <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es">
+ <!-- profiles and levels: ProfileCore : Level2 -->
+ <Limit name="size" min="16x16" max="176x144" />
+ <Limit name="alignment" value="16x16" />
+ <Limit name="block-size" value="16x16" />
+ <Limit name="blocks-per-second" range="12-1485" />
+ <Limit name="bitrate" range="1-64000" />
+ </MediaCodec>
+ <!-- Overwrites the max frame size to 1440p (see b/110911862). -->
+ <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
+ <Limit name="size" min="2x2" max="2560x2560" />
+ <Limit name="block-count" range="1-25600" />
+ <Limit name="blocks-per-second" range="1-1536000" />
+ </MediaCodec>
+ <!-- Overwrites the max frame size to 1440p (see b/110911862). -->
+ <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
+ <Limit name="size" min="2x2" max="2560x2560" />
+ <Limit name="block-count" range="1-25600" />
+ <Limit name="blocks-per-second" range="1-768000" />
+ </MediaCodec>
+ </Encoders>
+</Included>
diff --git a/init.ranchu.rc b/init.ranchu.rc
index 81bcc22..a8e96a2 100644
--- a/init.ranchu.rc
+++ b/init.ranchu.rc
@@ -21,6 +21,11 @@
mkdir /data/vendor/var/run 0755 root root
mkdir /data/vendor/var/run/netns 0755 root root
+ chown root root /data/vendor/etc
+ rm /data/vendor/etc/media_codecs_google_video.xml
+ symlink /data/vendor/etc/media_codecs_google_video_default.xml /data/vendor/etc/media_codecs_google_video.xml
+ setprop qemu.mediaprofile.video ${ro.kernel.qemu.mediaprofile.video}
+
on zygote-start
# Create the directories used by the Wireless subsystem
mkdir /data/vendor/wifi 0771 wifi wifi
@@ -33,6 +38,7 @@
setprop debug.hwui.renderer ${ro.kernel.qemu.uirenderer}
setprop ro.opengles.version ${ro.kernel.qemu.opengles.version}
setprop ro.zygote.disable_gl_preload 1
+
setprop dalvik.vm.heapsize 192m
setprop dalvik.vm.heapsize ${ro.kernel.qemu.dalvik.vm.heapsize}
chown root system /sys/power/wake_lock
@@ -53,6 +59,10 @@
group root
oneshot
+on property:qemu.mediaprofile.video=*
+ rm /data/vendor/etc/media_codecs_google_video.xml
+ symlink ${qemu.mediaprofile.video} /data/vendor/etc/media_codecs_google_video.xml
+
on property:vendor.qemu.timezone=*
setprop persist.sys.timezone ${vendor.qemu.timezone}
diff --git a/sepolicy/common/mediacodec.te b/sepolicy/common/mediacodec.te
index acf4e59..41241a3 100644
--- a/sepolicy/common/mediacodec.te
+++ b/sepolicy/common/mediacodec.te
@@ -1 +1,4 @@
allow mediacodec system_file:dir { open read };
+allow mediacodec vendor_data_file:dir search;
+allow mediacodec vendor_data_file:file { open read getattr };
+allow mediacodec vendor_data_file:lnk_file read;
diff --git a/vendor.mk b/vendor.mk
index c93516f..3391538 100644
--- a/vendor.mk
+++ b/vendor.mk
@@ -180,7 +180,8 @@
device/generic/goldfish/camera/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
- device/generic/goldfish/camera/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
+ device/generic/goldfish/camera/media_codecs_google_video_default.xml:data/vendor/etc/media_codecs_google_video_default.xml \
+ device/generic/goldfish/camera/media_codecs_google_video_v2.xml:data/vendor/etc/media_codecs_google_video_v2.xml \
device/generic/goldfish/camera/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
device/generic/goldfish/camera/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \