Failed to config mediacodec decoder on Android

This does not always happen, but it’s frequent. I tried both omxqcomvideodecoderavc and c2qtivideodecoder when using decodebin3, but got the same issue.

2025-05-13 14:07:59.559 26083-26157 CCodecConfig            com...ectricmaple.standalone_client  I  query failed after returning 17 values (BAD_INDEX)
2025-05-13 14:07:59.559 26083-26157 ColorUtils              com...ectricmaple.standalone_client  W  expected specified color aspects (0:0:255:255)
2025-05-13 14:07:59.560 26083-26155 NdkMediaCodec           com...ectricmaple.standalone_client  E  configure: err(-22), failed with format: AMessage(what = 0x00000000) = {
                                                                                                      string mime = "video/avc"
                                                                                                      int32_t width = 16
                                                                                                      int32_t height = 16
                                                                                                      RefBase *native-window = 0x7552ef0630
                                                                                                      int32_t flags = 0
                                                                                                      int32_t android._color-format = 2130708361
                                                                                                    }
2025-05-13 14:07:59.560 26083-26155 NdkMediaCodec           com...ectricmaple.standalone_client  E  sf error code: -22
2025-05-13 14:07:59.560 26083-26155 GStreamer+amcvideodec   com...ectricmaple.standalone_client  E  0:00:01.104139791 0x7422ee30d0 ../sys/androidmedia/gstamcvideodec.c:2029:gst_amc_video_dec_set_format:<amcvideodec-c2qtiavcdecoder0> Failed to configure codec
2025-05-13 14:07:59.560 26083-26155 GStreamer+amcvideodec   com...ectricmaple.standalone_client  W  0:00:01.104165572 0x7422ee30d0 ../sys/androidmedia/gstamcvideodec.c:2030:gst_amc_video_dec_set_format:<amcvideodec-c2qtiavcdecoder0> error: Failed to configure codec: -10000
2025-05-13 14:07:59.560 26083-26155 GStreamer+videodecoder  com...ectricmaple.standalone_client  W  0:00:01.104238385 0x7422ee30d0 ../gst-libs/gst/video/gstvideodecoder.c:928:gst_video_decoder_setcaps:<amcvideodec-c2qtiavcdecoder0> Subclass refused caps
2025-05-13 14:07:59.565 26083-26155 GStreamer+video-info    com...ectricmaple.standalone_client  W  0:00:01.108647760 0x7422ee30d0 ../gst-libs/gst/video/video-info.c:818:gst_video_info_to_caps invalid matrix 0 for RGB format, using RGB
2025-05-13 14:07:59.566 26083-26156 SurfaceUtils            com...ectricmaple.standalone_client  D  connecting to surface 0x7552eff4b0, reason connectToSurface
2025-05-13 14:07:59.566 26083-26156 MediaCodec              com...ectricmaple.standalone_client  I  [c2.qti.avc.decoder] setting surface generation to 26709006
2025-05-13 14:07:59.566 26083-26156 SurfaceUtils            com...ectricmaple.standalone_client  D  disconnecting from surface 0x7552eff4b0, reason connectToSurface(reconnect)
2025-05-13 14:07:59.566 26083-26156 SurfaceUtils            com...ectricmaple.standalone_client  D  connecting to surface 0x7552eff4b0, reason connectToSurface(reconnect)
2025-05-13 14:07:59.568 26083-26157 CCodec                  com...ectricmaple.standalone_client  W  failed to configure c2 params
2025-05-13 14:07:59.569 26083-26156 MediaCodec              com...ectricmaple.standalone_client  E  Codec reported err 0xffffffea, actionCode 0, while in state 3/CONFIGURING
2025-05-13 14:07:59.569 26083-26156 SurfaceUtils            com...ectricmaple.standalone_client  D  disconnecting from surface 0x7552eff4b0, reason disconnectFromSurface
2025-05-13 14:07:59.569 26083-26155 MediaCodec              com...ectricmaple.standalone_client  E  configure failed with err 0xffffffea, resetting...