'Could not retrieve application class loader' on Meta Quest 2 (Android)
I'm trying to use GStreamer 1.22.6 on a Meta Quest 2 (VR device). GStreamer itself works in tandem with a Unity application - C#/.NET for application and C++ native plugin to talk to GStreamer - for rendering, and I can successfully use elements such as avdec_h264
to decode streams, but I am having some problems with the androidmedia
hardware-accelerated elements and am not sure if this is a bug, lacking support on the device, or an error on my end.
From the initial error logs I was able to deduce that I need to copy over the GStreamer.java
file to my application to pass the appropriate context to GStreamer, which I did, and these errors are now solved. However, when now using hardware-accelerated elements such as amcviddec-omxqcomvideodecoderavc
or amcviddec-omxqcomvideodecoderhevc
, I still see errors (see logs below) about the application class loader not being found.
There are also some other files such as GstAmcOnFrameAvailableListener.java
that I'm not sure are necessary, but copied over anyway until I know better what is going on exactly - the tutorials don't seem to mention them, nor GStreamer.java
(but GStreamer fails hard if the latter is not present).
I'm also still getting OpenGL errors when trying to gldownload
right now, but those might be red herrings if valid textures aren't actually coming through properly due to the above - I can't be sure at this point. To clarify: I don't need or am not trying to capture the camera at all, just doing incoming streaming, so maybe it's this error that is a red herring and it's not blocking anything else? From the logs it looks like it's blocking all elements.
Pipeline
(Also tried this with HEVC.)
srtsrc latency=0 uri=srt://{DEFAULT_SERVER_IP_ADDRESS}:7000/
! h264parse
! amcviddec-omxqcomvideodecoderavc
! video/x-raw(memory:GLMemory), format=RGBA
! gldownload
! video/x-raw, format=RGBA
! appsink name=videoSink
Logs
11-15 16:14:25.845 8337 8364 E GStreamer: gst_amc_jni_object_local_unref: assertion 'object != NULL' failed
11-15 16:14:25.845 8337 8364 E GStreamer: gst_amc_jni_object_local_unref: assertion 'object != NULL' failed
11-15 16:14:25.845 8337 8364 E GStreamer: ../sys/androidmedia/gst-android-hardware-camera.c:_init_classes:1784: Failed to initialize android.hardware.Camera classes: Could not retrieve application class loader
11-15 16:14:25.845 8337 8364 E GStreamer: gst_amc_jni_object_local_unref: assertion 'object != NULL' failed
11-15 16:14:25.845 8337 8364 E GStreamer: gst_amc_jni_object_local_unref: assertion 'object != NULL' failed
11-15 16:14:25.845 8337 8364 E GStreamer: ../sys/androidmedia/gst-android-hardware-sensor.c:_init_classes:596: Failed to initialize Android classes: Could not retrieve application class loader
...
11-15 15:52:38.423 7287 7471 E GStreamer: gst_amc_jni_object_local_unref: assertion 'object != NULL' failed
11-15 15:52:38.423 7287 7471 E GStreamer: gst_amc_jni_object_local_unref: assertion 'object != NULL' failed
11-15 15:52:38.423 7287 7471 E GStreamer: ../sys/androidmedia/jni/gstamcsurfacetexture-jni.c:gst_amc_surface_texture_jni_set_on_frame_available_callback:345: Could not create listener: Could not retrieve application class loader
11-15 15:52:38.423 7287 7471 W GStreamer: ../sys/androidmedia/gstamcvideodec.c:gst_amc_video_dec_set_format:2010: error: Could not retrieve application class loader
11-15 15:52:38.423 7287 7471 I GStreamer: ../gst/gstelement.c:gst_element_message_full_with_details:2282: posting message: GStreamer encountered a general supporting library error.
11-15 15:52:38.423 7287 7456 W GStreamer: GstPipelineHandler::HandleMessage(): error in module amcvideodec-omxqcomvideodecoderavc0 reported: GStreamer encountered a general supporting library error. - ../sys/androidmedia/gstamcvideodec.c(2010): gst_amc_video_dec_set_format (): /GstPipeline:pipeline0/GstAmcVideoDec-OmxQcomVideoDecoderAvc:amcvideodec-omxqcomvideodecoderavc0:
11-15 15:52:38.423 7287 7456 W GStreamer: Could not retrieve application class loader
11-15 15:52:38.424 7287 7471 I GStreamer: ../gst/gstelement.c:gst_element_message_full_with_details:2309: posted error message: GStreamer encountered a general supporting library error.
11-15 15:52:38.424 7287 7471 W GStreamer: ../gst-libs/gst/video/gstvideodecoder.c:gst_video_decoder_setcaps:934: Subclass refused caps