How to create custom VideoDecoderFactory that supports H264 main profile


I am trying to get H264 Main profile (4d001f) to report as one of the supported codecs in the SDP offer. There is HW support on the rk3566 that this is intended for. I am able to manually edit the SDP offer to add this to the response and H264 M streams will decode correctly ( Have issues with releasing the decoder causing crashes and with errors decoding 2 h264 streams of different profiles).

I am aware of ModuleOptions to implement you own decoder factory, is there a way to report support for Main profile and have it correctly added to my offer? When I manually add a Main Profile VideoCodecInfo to the return of getSupportedCodecs() it does not propagate to the sdp offer.

// Example of manually adding Main profile
    public VideoCodecInfo[] getSupportedCodecs() {
        Map<String, String> h264_m_params = new HashMap();
        h264_m_params.put("level-asymmetry-allowed", "1");
        h264_m_params.put("packetization-mode", "1");
        h264_m_params.put("profile-level-id", "4d001f");

        VideoCodecInfo h264_m = new VideoCodecInfo("H264",h264_m_params);
        LinkedHashSet<VideoCodecInfo> supportedCodecInfos = new LinkedHashSet<VideoCodecInfo>();
        return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);

I assume it is due to to createDecoder() not working as the MediaCodecVideoDecoderFactory does some checks before passing on. I would overwrite this class but I cannot see a way to call AndroidVideoDecoder as it is package-private. Sorry if this is a simple mistake on my part this is my first time with Java.

PS. Does the factory create multiple instances of the HW decoder, say if I have 1 stream of Main and 1 stream of CB will it have separate instances for each stream.