Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
start resumes a paused pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
space-pope committed Aug 20, 2021
1 parent 10c8037 commit 3a0ad19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/io/spokestack/spokestack/SpeechPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,15 @@ public void removeListener(OnSpeechEventListener listener) {
}

/**
* starts up the speech pipeline.
* Starts the speech pipeline. If the pipeline is already running but has
* been paused, it will be resumed.
*
* @throws Exception on configuration/startup error
*/
public void start() throws Exception {
if (this.paused) {
resume();
}
if (this.running) {
this.context.traceDebug(
"attempting to start a running pipeline; ignoring");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ public void testPause() throws Exception {
pipeline.resume();
Thread.sleep(5);
assertTrue(FreeInput.counter > frames);

// test that start() also resumes the pipeline
pipeline.pause();
Thread.sleep(10);
frames = FreeInput.counter;
pipeline.start();
Thread.sleep(5);
assertTrue(FreeInput.counter > frames);
}

@Test
Expand Down

0 comments on commit 3a0ad19

Please sign in to comment.