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,13 +628,13 @@ UINT AudioSource::QueryAudio(float curVolume, bool bCanBurst)
|
|||||||
|
|
||||||
float *newBuffer = (bResample) ? tempResampleBuffer.Array() : tempBuffer.Array();
|
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);
|
AudioSegment *newSegment = new AudioSegment(newBuffer, numAudioFrames*2, lastUsedTimestamp);
|
||||||
AddAudioSegment(newSegment, curVolume*sourceVolume);
|
AddAudioSegment(newSegment, curVolume*sourceVolume);
|
||||||
}
|
|
||||||
|
|
||||||
lastSentTimestamp = lastUsedTimestamp;
|
lastSentTimestamp = lastUsedTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1058,12 +1058,16 @@ bool OBS::QueryNewAudio()
|
|||||||
|
|
||||||
if (!bAudioBufferFilled)
|
if (!bAudioBufferFilled)
|
||||||
{
|
{
|
||||||
|
QWORD timestamp;
|
||||||
|
|
||||||
// No more desktop data, drain auxilary/mic buffers until they're dry to prevent burst data
|
// No more desktop data, drain auxilary/mic buffers until they're dry to prevent burst data
|
||||||
OSEnterMutex(hAuxAudioMutex);
|
OSEnterMutex(hAuxAudioMutex);
|
||||||
for(UINT i=0; i<auxAudioSources.Num(); i++)
|
for(UINT i=0; i<auxAudioSources.Num(); i++)
|
||||||
{
|
{
|
||||||
while (auxAudioSources[i]->QueryAudio(auxAudioSources[i]->GetVolume(), true) != NoAudioAvailable);
|
while (auxAudioSources[i]->QueryAudio(auxAudioSources[i]->GetVolume(), true) != NoAudioAvailable);
|
||||||
auxAudioSources[i]->SortAudio(GetAudioTime());
|
|
||||||
|
if (auxAudioSources[i]->GetLatestTimestamp(timestamp))
|
||||||
|
auxAudioSources[i]->SortAudio(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSLeaveMutex(hAuxAudioMutex);
|
OSLeaveMutex(hAuxAudioMutex);
|
||||||
@ -1071,7 +1075,9 @@ bool OBS::QueryNewAudio()
|
|||||||
if (micAudio)
|
if (micAudio)
|
||||||
{
|
{
|
||||||
while (micAudio->QueryAudio(curMicVol, true) != NoAudioAvailable);
|
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