Skip to content

Demo_av Not sending last 0.1 second to soundbuffer #19

@Celestria

Description

@Celestria

See the following snippet of code:

void OpenAL_AudioInterface::insertData(float* data, int samplesCount)
...
for (int i = 0; i < samplesCount; ++i)
{
if (this->buffSize < this->maxBuffSize)
{
this->tempBuffer[this->buffSize] = float2short(data[i]);
++this->buffSize;
}
if (this->buffSize == this->frequency * this->channelsCount / 10)
{
...
this->bufferQueue.push(buff);

So insertData is called whenever theoraplayer thinks it should queue some sound.
The sound is locally stored in tempBuffer.
When tempbuffer is full enough (0,1 sec) "if (this->buffSize == this->frequency * this->channelsCount / 10)" An openAL buffer is created and the tempbuffer is "emptied".
If the decoder has reached the end and insertData is called for the last time it is possible that there is some sound in tempBuffer but not enough so that it is added to the bufferQueue. So up to almost 0.1 seconds of sound are missing from the playback.

I understand that this seems like a small issue because usually at the end of a movie the sound is muted anyway. But one of the first things I wanted to try is to see if I could get a movie (that has a looping sound from beginning to end) to autorestart and see if this was possible without noticing any audio/video glitches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions