fixed the sampleFormat size used in the frames calculation
This commit is contained in:
parent
c3c452ff5d
commit
824a48f8d2
2 changed files with 1 additions and 4 deletions
|
@ -171,12 +171,10 @@ void Client::loopPlayer() {
|
|||
throw std::runtime_error("[Client] Could not start the PortAudio stream: " + std::string(Pa_GetErrorText(error)));
|
||||
|
||||
// write the new audio data into the audio buffer
|
||||
// TODO(Faraphel) / 2 => / encoding size
|
||||
// TODO(Faraphel): the number of frames could be improved
|
||||
const int error = Pa_WriteStream(
|
||||
this->stream,
|
||||
audioPacket.content.data(),
|
||||
audioPacket.contentSize / 2 / this->streamChannels
|
||||
audioPacket.contentSize / Pa_GetSampleSize(this->streamSampleFormat) / this->streamChannels
|
||||
);
|
||||
switch (error) {
|
||||
// success
|
||||
|
|
|
@ -114,7 +114,6 @@ void Server::loop() const {
|
|||
|
||||
std::cout << "[Server] Sent: " << done << " bytes" << std::endl;
|
||||
|
||||
// TODO(Faraphel): should be extended to simulate live music streaming
|
||||
// wait for the duration of the audio chunk
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<uint64_t>(
|
||||
(1 / static_cast<double>(this->sampleRate * this->channels * mpg123_encsize(this->encoding))) *
|
||||
|
|
Loading…
Reference in a new issue