Also account for user-specified delay
- Woops, don't use global audio time for sorting, use the latest audio timestamp from that specific device. - Also, made it so lastSentTimestamp is only done when data is actually used, accidentally put it in the wrong scope.
This commit is contained in:
parent
327eda646d
commit
c042ffc6ac
@ -628,14 +628,14 @@ UINT AudioSource::QueryAudio(float curVolume, bool bCanBurst)
|
||||
|
||||
float *newBuffer = (bResample) ? tempResampleBuffer.Array() : tempBuffer.Array();
|
||||
|
||||
if (bCanBurst || lastUsedTimestamp >= lastSentTimestamp+10)
|
||||
bool overshotAudio = (lastUsedTimestamp < lastSentTimestamp+10);
|
||||
if (bCanBurst || !overshotAudio)
|
||||
{
|
||||
AudioSegment *newSegment = new AudioSegment(newBuffer, numAudioFrames*2, lastUsedTimestamp);
|
||||
AddAudioSegment(newSegment, curVolume*sourceVolume);
|
||||
lastSentTimestamp = lastUsedTimestamp;
|
||||
}
|
||||
|
||||
lastSentTimestamp = lastUsedTimestamp;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
return AudioAvailable;
|
||||
|
@ -1058,12 +1058,16 @@ bool OBS::QueryNewAudio()
|
||||
|
||||
if (!bAudioBufferFilled)
|
||||
{
|
||||
QWORD timestamp;
|
||||
|
||||
// No more desktop data, drain auxilary/mic buffers until they're dry to prevent burst data
|
||||
OSEnterMutex(hAuxAudioMutex);
|
||||
for(UINT i=0; i<auxAudioSources.Num(); i++)
|
||||
{
|
||||
while (auxAudioSources[i]->QueryAudio(auxAudioSources[i]->GetVolume(), true) != NoAudioAvailable);
|
||||
auxAudioSources[i]->SortAudio(GetAudioTime());
|
||||
|
||||
if (auxAudioSources[i]->GetLatestTimestamp(timestamp))
|
||||
auxAudioSources[i]->SortAudio(timestamp);
|
||||
}
|
||||
|
||||
OSLeaveMutex(hAuxAudioMutex);
|
||||
@ -1071,7 +1075,9 @@ bool OBS::QueryNewAudio()
|
||||
if (micAudio)
|
||||
{
|
||||
while (micAudio->QueryAudio(curMicVol, true) != NoAudioAvailable);
|
||||
micAudio->SortAudio(GetAudioTime());
|
||||
|
||||
if (micAudio->GetLatestTimestamp(timestamp))
|
||||
micAudio->SortAudio(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user