Xperia 10 III (5.2.0.22): video recording always fails, "error starting video recorder" / CameraSource -22

Device: Sony Xperia 10 III, XQ-BT52 (pdx213, “lena”) Sailfish OS: 5.2.0.22 (Finlayson), kernel 4.19.248 Stock Android before flashing: XQ-BT52 Customized EEA 62.0.A.9.11 (Android 11) Vendor fingerprint: Sony/aosp_xqbt52/pdx213:11/RQ3A.211001.001/jolla08301829:user/test-keys, ro.odm.expect.version=11_4.19_lena_v9 Packages: droidmedia 0.20260522.0-1.10.1, gstreamer1.0-droid 0.20260508.1-1.9.2, gstreamer1.0 1.26.11, qt5-qtmultimedia 5.6.2+git34, libhybris 0.0.5.58

Problem

Video recording never works, on both cameras. The Jolla Camera app fails to record, and so does a minimal GStreamer test without any app. Photos and the viewfinder work normally.

Minimal reproduction (no app, normal user, no root)

droidcamsrc in video mode with its built-in recorder (vidsrc negotiated to H.264), recording started with the start-capture action, the way camerabin does it:

import gi; gi.require_version("Gst", "1.0")
from gi.repository import Gst, GLib
Gst.init(None)
p = Gst.parse_launch(
    "droidcamsrc mode=2 camera-device=0 name=cam "
    "cam.vfsrc ! video/x-raw(memory:DroidMediaQueueBuffer),width=1280,height=720 ! fakesink sync=false async=false "
    "cam.vidsrc ! video/x-h264,stream-format=avc,alignment=au,width=1280,height=720,framerate=30/1 "
    "! h264parse ! mp4mux ! filesink location=/tmp/rec.mp4 async=false")
p.set_state(Gst.State.PLAYING)
GLib.timeout_add(2000, lambda: p.get_by_name("cam").emit("start-capture") and False)
GLib.timeout_add(6000, lambda: p.send_event(Gst.Event.new_eos()) and False)
GLib.MainLoop().run()

Result, every time (~0.8 s after start-capture), 0-byte file:

gstdroidcamsrcdev.c:1291:gst_droidcamsrc_dev_start_video_recording_recorder_locked:<cam> error: error starting video recorder
gstdroidcamsrc.c:2112:gst_droidcamsrc_start_video_recording_locked:<cam> failed to start video recording
gstdroidcamsrcdev.c:170:gst_droidcamsrc_dev_error_callback:<cam> error: error 0x2 from camera HAL

Tested and failing the same way:

  • back camera (0): 1920x1080, 1440x1080, 1280x720 and 640x480;
  • front camera (1): 1280x720 and 640x480;
  • viewfinder sizes equal to or different from the video size.

With the raw path (vidsrc as DroidVideoMetaData into droidvenc), recording starts (“Recording in buffer queue mode”), but no frame reaches the encoder: DroidMediaBufferQueue: Client wasn't able to handle a received frame. repeats and the file stays empty.

Logs

Right at start-capture, the test process prints (stderr, from the bionic linker):

library "/apex/com.android.vndk.v30/lib64/hw/android.hidl.memory@1.0-impl.so" needed or dlopened by
"/usr/libexec/droid-hybris/system/lib64/libvndksupport.so" is not accessible for the namespace "sphal"

The file exists (/apex/com.android.vndk.v30/lib64/hw/android.hidl.memory@1.0-impl.so, also in /system/lib64/hw/).

Directly afterwards in logcat:

W DroidMediaCodec: Creating video encoder for video/avc
I ACodec  : setupAVCEncoderParameters with [profile: Baseline] [level: Level31]
I ACodec  : setupVideoEncoder succeeded
I MediaCodecSource: MediaCodecSource (video) starting
I CameraSource: Using encoder format: 0x22
I CameraSource: Using encoder data space: 0x104
E CameraSource: Failed to start recording, received error: Invalid argument (-22)
E DroidMediaRecorder: error 0x16 starting codec

The Jolla Camera app logs the same CameraSource lines (encoder Level4, i.e. 1080p) when recording. In earlier tests the camera provider (android.hardware.camera.provider@2.4-service_64) sometimes crashed (SIGSEGV) after this error. In today’s tests the crash buffer stayed empty.

My reading: the encoder is set up fine. Starting the camera recording fails when libvndksupport cannot load the HIDL memory implementation in the sphal namespace. That looks like a linker namespace configuration problem in the droid-hybris system.

Ruled out

The failure stays identical (rebooted after each step) after:

  • removing Patchmanager (including /etc/ld.so.preload), all patches and sanefish;
  • removing rawfish-ir-cli / rawfish-ir-gui (which installs a library into /usr/libexec/droid-hybris/system/lib64);
  • disabling CPU/GPU tuning services (sfos-qcom-boost, a cpufreq tuner);
  • stopping Android App Support (its cameraserver no longer running).

No third-party package replaces GStreamer, droidmedia, gst-droid, libhybris or files under /system, /vendor or /odm. The repos offer no newer droidmedia or gst-droid for 5.2.0.22.

Open question

/odm/etc/build.prop is empty, so I cannot confirm that the flashed Sony binaries are the required SW_binaries_for_Xperia_Android_11_4.19_v9a_lena (the /odm files are dated 2021-11-30). Could a wrong vendor image cause exactly this, or is this a known droidmedia / linker-config issue on lena with 5.2?

Can anyone with an Xperia 10 III on 5.2.0.22 confirm whether video recording works for them?

(I’ve created this report with the help of AI, since my analytics skills with SFOS are very basic)

Anybody any idea why it crashes after just 1 second.?

@roterfux Same XQ-BT52 here on 5.2.0.22 with your exact package versions, and video recording works, so it’s likely not the 5.2.0.22 packages but something device-side (e.g. the missing libswregistrationalgo.so in /odm/lib64, which I had to supply myself). You may point your LLM at GitHub - JimKnopfIoT/harbour-advanced-camera · GitHub, the README explains that crash, its cause and the fix in detail.

thx a lot. that might really fix the whole issue. I’ll look into it. very complicated and complex issue