void stop()

in src/backend/transcriber/src/main/java/com/amazonaws/transcriber/Encoder.java [104:129]


    void stop() throws IOException {
        if ((process != null)) {
            if(process.isAlive()) {
                try {
                    stdinWriter.write("q");
                    stdinWriter.flush();
                    process.wait(1000);
                } catch (InterruptedException ex) {
                    logger.info("ffmpeg thread for {} has been interrupted.", input);
                } catch (IOException e) {
                    logger.error("Error quiting ffmpeg process", e);
                } finally {
                    if ((process != null) && process.isAlive()) {
                        process.destroy();
                    }
                    if (stderrReaderThread != null) {
                        stderrReaderThread.interrupt();
                        stderrReaderThread = null;
                    }
                }
            }
            if(process.exitValue() != 0) {
                throw new IOException(this.error);
            }
        }
    }