From d9077bb815cb17b8fd71d98f6594a61dc298a559 Mon Sep 17 00:00:00 2001 From: enm10k Date: Tue, 16 Apr 2024 15:34:47 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=83=E3=83=95=E3=82=A1=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E7=A9=BA=E3=81=8B=E7=A2=BA=E8=AA=8D=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=9F=E3=83=B3=E3=82=B0=E3=81=8C=E9=96=93?= =?UTF-8?q?=E9=81=95=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sora_audio_sink.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sora_audio_sink.cpp b/src/sora_audio_sink.cpp index 239473b9..63de306d 100644 --- a/src/sora_audio_sink.cpp +++ b/src/sora_audio_sink.cpp @@ -134,10 +134,6 @@ void SoraAudioSinkImpl::AppendData(const int16_t* audio_data, nb::tuple SoraAudioSinkImpl::Read(size_t frames, float timeout) { std::unique_lock lock(buffer_mtx_); - if (buffer_.size() == 0) { - // 返すものがない時は即座に返す - return nb::make_tuple(false, nb::none()); - } size_t num_of_samples; if (frames > 0) { // フレーム数のリクエストがある場合はリクエスト分が貯まるまで待つ @@ -160,6 +156,9 @@ nb::tuple SoraAudioSinkImpl::Read(size_t frames, float timeout) { } } else { // フレーム数のリクエストがない場合はあるだけ全部出す + if (buffer_.empty()) { + return nb::make_tuple(false, nb::none()); + } num_of_samples = buffer_.size(); }