private Pad buildRtpDepayPath()

in src/main/java/com/aws/iot/edgeconnectorforkvs/videorecorder/RecorderCameraRtsp.java [124:171]


    private Pad buildRtpDepayPath(Structure capStruct) {
        Pad rtpDepaySinkPad = null;
        boolean hasMedia = this.gstCore.hasStructureField(capStruct, "media");
        boolean hasEncode = this.gstCore.hasStructureField(capStruct, "encoding-name");

        if (hasMedia && hasEncode) {
            String media = this.gstCore.getStructureString(capStruct, "media");
            String encode = this.gstCore.getStructureString(capStruct, "encoding-name");

            log.debug("media = " + media + ", encoding = " + encode);

            if (!media.equals("video") && !media.equals("audio")) {
                log.warn("Unsupported RTP media type: " + media);
            } else if (!ConfigRtp.DEPAY_INFO.containsKey(encode)) {
                log.warn("Unsupported RTP encode: " + encode);
            } else {
                RecorderCapability recCap = null;
                Element depayElm = this.gstCore.newElement(ConfigRtp.DEPAY_INFO.get(encode));

                if (media.equals("video")) {
                    recCap = RecorderCapability.VIDEO_ONLY;
                } else {
                    recCap = RecorderCapability.AUDIO_ONLY;
                }

                this.gstCore.addPipelineElements(this.pipeline, depayElm);

                if (ConfigCodec.PARSE_INFO.containsKey(encode)) {
                    Element parseElm = this.gstCore.newElement(ConfigCodec.PARSE_INFO.get(encode));
                    Pad parsePad = this.gstCore.getElementStaticPad(parseElm, "src");

                    this.gstCore.addPipelineElements(this.pipeline, parseElm);
                    this.gstCore.linkManyElement(depayElm, parseElm);
                    this.getPadListener().onNotify(recCap, parsePad);
                    this.gstCore.playElement(parseElm);
                } else {
                    Pad depayPad = this.gstCore.getElementStaticPad(depayElm, "src");
                    this.getPadListener().onNotify(recCap, depayPad);
                }

                this.gstCore.playElement(depayElm);

                rtpDepaySinkPad = this.gstCore.getElementStaticPad(depayElm, "sink");
            }
        }

        return rtpDepaySinkPad;
    }