private void bindCameraToTee()

in src/main/java/com/aws/iot/edgeconnectorforkvs/videorecorder/base/VideoRecorderBase.java [332:374]


    private void bindCameraToTee(@NonNull RecorderCapability cap, Pad newPad) {
        Element teeElm = null;

        switch (cap) {
            case AUDIO_ONLY:
                if (this.teeAudioIdx.get() < this.teeAudios.size()) {
                    teeElm = this.teeAudios.get(this.teeAudioIdx.getAndIncrement());
                } else {
                    log.error("Get audio tee out of range");
                    this.willStopRecording(false, "Get audio tee out of range");
                    return;
                }
                break;

            case VIDEO_ONLY:
                if (this.teeVideoIdx.get() < this.teeVideos.size()) {
                    teeElm = this.teeVideos.get(this.teeVideoIdx.getAndIncrement());
                } else {
                    log.error("Get video tee out of range");
                    this.willStopRecording(false, "Get video tee out of range");
                    return;
                }
                break;

            default:
                throw new RejectedExecutionException("Invalid capability from RecorderCamera");
        }

        Pad teeSink = this.gstCore.getElementStaticPad(teeElm, "sink");

        if (this.gstCore.isPadLinked(teeSink)) {
            log.info("Unbind camera and tee before relinking.");
            Pad camPad = this.gstCore.getPadPeer(teeSink);
            this.gstCore.unlinkPad(camPad, teeSink);
        }
        try {
            this.gstCore.linkPad(newPad, teeSink);
            log.debug("Camera and tee linked.");
        } catch (PadLinkException ex) {
            log.error("Camera and tee link failed: " + ex.getLinkResult());
            this.willStopRecording(false, "Camera and tee link failed: " + ex.getLinkResult());
        }
    }