Day 4 Season 2
ngfd and video recording - day 35
Speaking of ngfd. I do have “native vibrator” in the config package.
But I don’t have it in my previous port. It’s memless based.
Let’s see what that package has:
rpm -ql ngfd-plugin-native-vibrator
/usr/lib64/ngf/libngfd_droid-vibrator.so
/usr/share/doc/ngfd-plugin-native-vibrator-1.3.0
/usr/share/doc/ngfd-plugin-native-vibrator-1.3.0/COPYING
/usr/share/doc/ngfd-plugin-native-vibrator-1.3.0/README
/usr/share/ngfd/plugins.d/50-droid-vibrator.ini
I think that only that last ini file matters. Let’s move it out. mv 50-droid-vibrator.ini 40-droid-vibrator.bak
Now let’s increase ngfd verbosity. The service file says:
EnvironmentFile=-/etc/sysconfig/ngfd
ExecStart=/usr/bin/ngfd $NGFD_ARGS
That doesn’t exist, so I create it with `NGFD_ARGS=“-vvv”
Hmm… that does show a pagefull of logs at init in journal, but no ffmemless as on my previous device.
So maybe I was wrong that only the .ini file mattered.
Let’s move out the libngfd_droid-vibrator.so too?
Apr 22 01:28:30 Zenfone8 ngfd[13210]: [0.006] DEBUG: core: opened plugin 'ffmemless' (libngfd_ffmemless.so)
Apr 22 01:28:30 Zenfone8 ngfd[13210]: [0.007] ERROR: core: unable to open plugin 'droid-vibrator'
Ok, that’s better(?) but no vibra.
Let’s look at 50-ffmemless.ini
Copying it from my device…
Still no vibra, and I’m not sure that the ffmemless is used, even with -vvv
Video recording
If you remember, it starts now, but crashes at stop. It says:
ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
This may need droidmedia changes indeed. A message from 2019 says to set
MINIMEDIA_AUDIOPOLICYSERVICE_ENABLE=1
But there are recent developments by Thaodan that enable the fake audio policy service by default.
But I don’t have them in my git log
of external/droidmedia
… Because I’m at tag 0.20211101.0
And this is because I’m still building 4.4. I should change that, but I hoped I will change it when uploading my packages to OBS.
Enabling then that “old” flag in env.mk
and TEMPORARY_DISABLE_PATH_RESTRICTIONS=true make -j$(nproc --all) droidmedia
on host
In file included from external/droidmedia/minimedia.cpp:24:
frameworks/av/media/libaudioclient/include/media/AudioTrack.h:25:10: fatal error: ‘media/MediaMetricsItem.h’ file not found
#include <media/MediaMetricsItem.h>
Which does exist in
$ find . -iname MediaMetricsItem.h
./frameworks/av/media/libmediametrics/include/media/MediaMetricsItem.h
The Android.mk
has this
ifeq ($(shell test $(ANDROID_MAJOR) -ge 11 && echo true),true)
LOCAL_C_INCLUDES += frameworks/av/media/libmediametrics/include \
frameworks/av/media/libstagefright/include \
frameworks/av/drm/libmediadrm/interface
So I just add the libmediametrics… wait, it’s already there.
It seems that the above include was used for include $(BUILD_SHARED_LIBRARY)
then include $(CLEAR_VARS)
is issued and another build is described below:
ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),11))
LOCAL_SHARED_LIBRARIES += android.hardware.camera.provider@2.6
+LOCAL_C_INCLUDES += frameworks/av/media/libmediametrics/include \
+ frameworks/av/media/utils/include
endif
Let’s see what’s to scp. On host:
$ ls -l out/target/product/sake/system/bin/minimediaservice
-rwxr-xr-x 1 vlad vlad 54600 Apr 22 13:25 out/target/product/sake/system/bin/minimediaservice
On device:
# ls -l /usr/libexec/droid-hybris/system/bin/minimediaservice
-rwxr-xr-x 1 root root 54244 Mar 23 22:48 /usr/libexec/droid-hybris/system/bin/minimediaservice
(libdroidmedia.so
doesn’t seem to change)
reboot.
Hmm
F linker : CANNOT LINK EXECUTABLE “/usr/libexec/droid-hybris/system/bin/minimediaservice”: library “libaudiopolicyservice.so” not found: needed by main executable
One more scp? Not only that. The excutable looks in system/lib, vendor/lib and
openat(AT_FDCWD, "/odm/lib/libaudiopolicyservice.so", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
The last one we control, so I link (along with the next files discovered to be missing):
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicyservice.so /odm/lib/
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicymanager.so /odm/lib/
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicymanagerdefault.so /odm/lib/
ln -s /usr/libexec/droid-hybris/system/lib/libaudiopolicyenginedefault.so /odm/lib/
(This is the stuff you need to do when you’re too lazy to rebuild the rpm package I guess…)
Arrgh and it goes on and on:
Now camera doesn’t start at all because Waiting for service 'media.camera' on '/dev/binder'
and ServiceManager: Service media.camera didn't start.
Probably, as Thaodan says, the old MINIMEDIA_AUDIOPOLICYSERVICE_ENABLE is not ‘fake’ enough so it requires real android audio services.
Turning point:
- build the rinigus miniaudiopolicy that I know works for Sailfish 4.4. and older
- or just rebuild everything with Sailfish 4.5
- try to backport Thaodan’s patches
- just use newer droidmedia from 4.5 - but that also needs newer gst-droid (According to Changelog_from_4.4.0.72_to_4.5.0.16.md, the new gst-droid is 0.20221003.0)
Decisions… decisions.
Let’s go with 4:) First build gst-droid, see if it works.
This is useful for uploading the correct droidmedia to OBS to build 4.5.x
PlatformSDK [hybris/mw]$ git clone https://github.com/sailfishos/gst-droid.git --branch 0.20221003.0
PlatformSDK [hadk]$ rpm/dhd/helpers/build_packages.sh -b hybris/mw/gst-droid
Success. A fresh new hadk/droid-local-repo/sake/gstreamer1.0-droid-0.20221003.0-1.aarch64.rpm
waits to get scp’d.
Let’s see about that droidmedia.
HABUILD_SDK [external/droidmedia]$ git checkout 0.20220929.0
HABUILD_SDK [hadk]$ TEMPORARY_DISABLE_PATH_RESTRICTIONS=true make -j$(nproc --all) droidmedia
PlatformSDK [hadk]$ rpm/dhd/helpers/build_packages.sh --gg
Building rpm/droidmedia.spec
echo /usr/libexec/droid-hybris/system/etc/init/disabled_services.rc /usr/libexec/droid-hybris/system/etc/init/ecclist.rc /usr/libexec/droid-hybris/system/etc/init/servicemanager.rc
…
Processing files: droidmedia-0.20220929.0-1.aarch64
error: File not found: /home/vlad/hadk/hybris/mw/droidmedia-localbuild/installroot/usr/libexec/droid-hybris/system/etc/init/disabled_services.rc
error: More than one file on a line: /usr/libexec/droid-hybris/system/etc/init/ecclist.rc
error: More than one file on a line: /usr/libexec/droid-hybris/system/etc/init/servicemanager.rc
Of course Elros’ hadk-hot already covers this: droid-hal-device: <= 960d6af
for 4.5 building.
And rm -rf hybris/mw/droidmedia-localbuild
then and it built.
scp packages to device, install, removed /home/defaultuser/.cache/gstreamer*
and reboot
Ah… same results with camera recording.
Even worse, now browser crashes when playing video.
Let’s zypper rm gecko-camera-droid-plugin
as seen on [4.5.0.16] Video playback in browser not working - #5 by vlagged
Is this cargo cult debugging. It worked, at least browser playback is restored.
But it breaks browser webcam (because … gecko-camera,… get it?)
Hmm. Installed back gecko-camera - webcam works, at least on second try (crash on the first…)
kernel: Failed to create debugfs for msm_vidc
# mount -t debugfs none /sys/kernel/debug
doesn’t work, nor creating that directory.
Other things:
export GECKO_CAMERA_DROID_NO_MEDIA_BUFFER=1
would work? /usr/lib/systemd/system/user@.service
shows some environment files.
# vi /var/lib/environment/nemo/70-browser.conf
That flag that worked to solve other problems for piggz (garbage playback).
Let’s continue camera recording and leave the browser a bit as it is. The 4.5 browser may have different behavior, hopefully.
Journal: Ubuntu Pastebin
Logcat: Ubuntu Pastebin
Codec2Buffer: GraphicMetadataBuffer does not work on 64-bit arch
Seems I have sources for this: frameworks/av/media/codec2/sfplugin/Codec2Buffer.cpp
They effectively don’t have the 64-bit implementation and put that message instead.
The process that gives the error is jolla-camera. How could this be? Jolla camera links to something which includes this 64-bit code.
Hmm… so plan 4 was not the best.
I don’t know if the errors are specific to 4.4 using droidmedia from the future or just 4.5 errors I will come to see.
I have to sleep on it.