Skip to content

Commit

Permalink
初回のみ IosAudioInit を呼ぶようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Aug 31, 2023
1 parent 4ea9ecf commit a3d172d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/sora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,18 @@ void Sora::Connect(const sora_conf::internal::ConnectConfig& cc) {
return;
}

IosAudioInit(
[this, on_disconnect = std::move(on_disconnect)](std::string error) {
if (!error.empty()) {
RTC_LOG(LS_ERROR) << "Failed to IosAudioInit: error=" << error;
on_disconnect((int)sora_conf::ErrorCode::INTERNAL_ERROR,
"Failed to IosAudioInit: error=" + error);
}
});
static bool ios_audio_init = false;
if (!ios_audio_init) {
IosAudioInit(
[this, on_disconnect = std::move(on_disconnect)](std::string error) {
if (!error.empty()) {
RTC_LOG(LS_ERROR) << "Failed to IosAudioInit: error=" << error;
on_disconnect((int)sora_conf::ErrorCode::INTERNAL_ERROR,
"Failed to IosAudioInit: error=" + error);
}
ios_audio_init = true;
});
}
DoConnect(cc, std::move(on_disconnect));
#else
DoConnect(cc, std::move(on_disconnect));
Expand Down

0 comments on commit a3d172d

Please sign in to comment.