Skip to content

Commit

Permalink
disable pulseaudio if failed to init (HarbourMasters#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alto1772 authored Nov 17, 2022
1 parent 8525451 commit 44c9386
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/audio/PulseAudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ bool PulseAudioPlayer::DoInit() {
pa_mainloop_free(mMainLoop);
mMainLoop = NULL;
}

SPDLOG_ERROR("Failed to initialize PulseAudio stream!");
return false;
}

Expand All @@ -165,6 +167,10 @@ int PulseAudioPlayer::GetDesiredBuffered() {
}

void PulseAudioPlayer::Play(const uint8_t* buff, size_t len) {
if (mStream == NULL || mContext == NULL || mMainLoop == NULL) {
return;
}

size_t ws = mAttr.maxlength - Buffered() * 4;
if (ws < len) {
len = ws;
Expand Down

0 comments on commit 44c9386

Please sign in to comment.