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

Commit a785813

Browse files
committed
start resumes a paused pipeline
1 parent be28ef2 commit a785813

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/io/spokestack/spokestack/SpeechPipeline.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,14 @@ public void removeListener(OnSpeechEventListener listener) {
167167
}
168168

169169
/**
170-
* starts up the speech pipeline.
170+
* Starts the speech pipeline. If the pipeline is already running but has
171+
* been paused, it will be resumed.
171172
*
172173
* @throws Exception on configuration/startup error
173174
*/
174175
public void start() throws Exception {
175176
if (this.running) {
177+
resume();
176178
this.context.traceDebug(
177179
"attempting to start a running pipeline; ignoring");
178180
return;

src/test/java/io/spokestack/spokestack/SpeechPipelineTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ public void testPause() throws Exception {
241241
pipeline.resume();
242242
Thread.sleep(5);
243243
assertTrue(FreeInput.counter > frames);
244+
245+
// test that start() also resumes the pipeline
246+
pipeline.pause();
247+
Thread.sleep(10);
248+
frames = FreeInput.counter;
249+
pipeline.start();
250+
Thread.sleep(5);
251+
assertTrue(FreeInput.counter > frames);
244252
}
245253

246254
@Test

0 commit comments

Comments
 (0)