public void startRecording()

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


    public void startRecording() {
        if (this.getStatus() == RecorderStatus.STOPPED
                || this.getStatus() == RecorderStatus.FAILED) {
            this.teeVideoIdx.set(0);
            this.teeAudioIdx.set(0);
            this.gstCore.playElement(this.pipeline);
            this.setStatus(RecorderStatus.STARTED, "Recording starts");

            this.condLock.lock();
            try {
                while (this.getStatus() == RecorderStatus.STARTED) {
                    this.stopRunningLoop.await();
                }
            } catch (Exception e) {
                log.error(String.format("startRecording fails: %s", e.getMessage()));
                this.setStatus(RecorderStatus.STOPPING_ABNORMAL,
                        String.format("startRecording fails: %s", e.getMessage()));
            } finally {
                this.condLock.unlock();
            }

            log.info("Leave recording loop");
            this.gstCore.stopElement(this.pipeline);
            log.info("notify stop");

            if (this.getStatus() == RecorderStatus.STOPPING_ABNORMAL) {
                this.setStatus(RecorderStatus.FAILED, "Recording Stopped by failure");
            } else {
                this.setStatus(RecorderStatus.STOPPED, "Recording Stopped normally");
            }
        } else {
            log.warn("Cannot start recording because current state is " + this.getStatus());
        }
    }