diff --git a/c2.mk b/c2.mk index 4bcceac..ab0fad5 100644 --- a/c2.mk +++ b/c2.mk @@ -1,3 +1,4 @@ PRODUCT_COPY_FILES += \ hardware/redroid/c2/redroid.c2.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/redroid.c2.rc \ + hardware/redroid/c2/redroid.c2.sh:$(TARGET_COPY_OUT_VENDOR)/bin/redroid.c2.sh \ hardware/redroid/c2/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy \ diff --git a/redroid.c2.rc b/redroid.c2.rc index e5a52c4..b69d843 100644 --- a/redroid.c2.rc +++ b/redroid.c2.rc @@ -1,6 +1,5 @@ on init - setprop debug.stagefright.c2inputsurface -1 - setprop debug.stagefright.ccodec 4 + exec -- /vendor/bin/redroid.c2.sh on init && property:ro.boot.use_dmabufheaps=* setprop debug.c2.use_dmabufheaps ${ro.boot.use_dmabufheaps} diff --git a/redroid.c2.sh b/redroid.c2.sh new file mode 100755 index 0000000..4678db6 --- /dev/null +++ b/redroid.c2.sh @@ -0,0 +1,7 @@ +#!/system/bin/sh + +# enable codec2 only when dmabuf_heap or ion available +if [ -c /dev/dma_heap/system ] || [ -c /dev/ion ];then + setprop debug.stagefright.c2inputsurface -1 + setprop debug.stagefright.ccodec 4 +fi