mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-18 04:42:45 +01:00
oboe_sink: handle temporary stream creation failure
This commit is contained in:
parent
2c00599a53
commit
964e19ab56
1 changed files with 6 additions and 2 deletions
|
@ -67,11 +67,15 @@ public:
|
||||||
oboe::AudioStreamBuilder builder;
|
oboe::AudioStreamBuilder builder;
|
||||||
|
|
||||||
const auto result = ConfigureBuilder(builder, direction)->openStream(temp_stream);
|
const auto result = ConfigureBuilder(builder, direction)->openStream(temp_stream);
|
||||||
ASSERT(result == oboe::Result::OK);
|
if (result == oboe::Result::OK) {
|
||||||
|
|
||||||
return temp_stream->getChannelCount() >= 6 ? 6 : 2;
|
return temp_stream->getChannelCount() >= 6 ? 6 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_ERROR(Audio_Sink, "Failed to open {} stream. Using default channel count 2",
|
||||||
|
direction == oboe::Direction::Output ? "output" : "input");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
oboe::DataCallbackResult onAudioReady(oboe::AudioStream*, void* audio_data,
|
oboe::DataCallbackResult onAudioReady(oboe::AudioStream*, void* audio_data,
|
||||||
s32 num_buffer_frames) override {
|
s32 num_buffer_frames) override {
|
||||||
|
|
Loading…
Reference in a new issue