public boolean toggleEmit()

in src/main/java/com/aws/iot/edgeconnectorforkvs/videorecorder/RecorderBranchApp.java [63:92]


    public boolean toggleEmit(boolean toEnable) {
        boolean isChanged = false;

        if (this.isEmitEnabled() != toEnable) {
            // We want to detach branch because of stop emitting or reattaching
            if ((this.isBranchAttached() && !this.isAttachedExplicitly()) || !toEnable) {
                this.detach();
                this.gstCore.stopElement(this.appSink);
                this.gstCore.stopElement(this.muxer);
                this.gstCore.setElement(appSink, "drop", true);
                this.gstCore.setElement(appSink, "max-buffers", 1);
            }

            if (toEnable) {
                this.gstCore.setElement(appSink, "drop", false);
                this.gstCore.setElement(appSink, "max-buffers", 0);
                this.attach();
                this.gstCore.syncElementParentState(this.muxer);
                this.gstCore.syncElementParentState(this.appSink);
            }

            this.gstCore.setElement(this.appSink, "emit-signals", toEnable);
            this.isEmitSignalEnabled = toEnable;
            isChanged = true;
        } else {
            log.info("App path emit signal is already toggled " + toEnable);
        }

        return isChanged;
    }