From b10faa9683974d125a8ef6256cf1fa464b9cd52a Mon Sep 17 00:00:00 2001 From: Soji Yamakawa Date: Wed, 8 Nov 2023 23:01:18 -0500 Subject: [PATCH] YsSoundPlayer::StreamPlayerReadyToAcceptNextSegment returns error if the given segment is longer than the half of the requested ring-buffer length. --- src/yssimplesound/src/yssimplesound.cpp | 13 +++++++++++++ src/yssimplesound/src/yssimplesound.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/yssimplesound/src/yssimplesound.cpp b/src/yssimplesound/src/yssimplesound.cpp index 5ecd987..59e498b 100644 --- a/src/yssimplesound/src/yssimplesound.cpp +++ b/src/yssimplesound/src/yssimplesound.cpp @@ -171,6 +171,7 @@ void YsSoundPlayer::PlayBackground(SoundData &dat) YSRESULT YsSoundPlayer::StartStreaming(Stream &streamPlayer,StreamingOption opt) { + streamPlayer.requestedRingBufferLengthMillisec=opt.ringBufferLengthMillisec; return StartStreamingAPISpecific(streamPlayer,opt); } @@ -197,6 +198,18 @@ YSBOOL YsSoundPlayer::StreamPlayerReadyToAcceptNextSegment(const Stream &streamP { return YSFALSE; } + + uint32_t millisec=dat.GetNumSamplePerChannel()*1000/dat.PlayBackRate(); + if(streamPlayer.requestedRingBufferLengthMillisec