Skip to content

Commit

Permalink
Check audio stream start result
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Jun 11, 2024
1 parent 479e622 commit 5934dbf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions voicesmith/src/main/cpp/de/jurihock/voicesmith/io/AudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ void AudioStream::open() {
if (result != oboe::Result::OK) {
close();
throw std::runtime_error(
$("Unable to open audio source stream: {0}",
$("Unable to open the {0} stream: {1}",
oboe::convertToText(direction),
oboe::convertToText(result)));
}

Expand Down Expand Up @@ -171,7 +172,16 @@ void AudioStream::start() {

state.xrun.reset();
state.xruns = xruns ? xruns.value() : 0;
state.stream->start();

const oboe::Result result = state.stream->start();

if (result != oboe::Result::OK) {
stop();
throw std::runtime_error(
$("Unable to start the {0} stream: {1}",
oboe::convertToText(direction),
oboe::convertToText(result)));
}
}

void AudioStream::stop() {
Expand Down

0 comments on commit 5934dbf

Please sign in to comment.