wasapi: Don't derive device period from latency time
This seems to cause glitches on devices with low CPU availability, such as virtual machines. Maybe even actual machines under high load. https://bugzilla.gnome.org/show_bug.cgi?id=794497
This commit is contained in:
parent
275d754156
commit
41a4a8fe0d
@ -917,12 +917,10 @@ gst_wasapi_util_initialize_audioclient3 (GstElement * self,
|
|||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
gint stream_flags;
|
gint stream_flags;
|
||||||
guint rate, devicep_frames;
|
guint devicep_frames;
|
||||||
guint defaultp_frames, fundp_frames, minp_frames, maxp_frames;
|
guint defaultp_frames, fundp_frames, minp_frames, maxp_frames;
|
||||||
WAVEFORMATEX *tmpf;
|
WAVEFORMATEX *tmpf;
|
||||||
|
|
||||||
rate = GST_AUDIO_INFO_RATE (&spec->info);
|
|
||||||
|
|
||||||
hr = IAudioClient3_GetSharedModeEnginePeriod (client, format,
|
hr = IAudioClient3_GetSharedModeEnginePeriod (client, format,
|
||||||
&defaultp_frames, &fundp_frames, &minp_frames, &maxp_frames);
|
&defaultp_frames, &fundp_frames, &minp_frames, &maxp_frames);
|
||||||
HR_FAILED_RET (hr, IAudioClient3::GetSharedModeEnginePeriod, FALSE);
|
HR_FAILED_RET (hr, IAudioClient3::GetSharedModeEnginePeriod, FALSE);
|
||||||
@ -931,16 +929,12 @@ gst_wasapi_util_initialize_audioclient3 (GstElement * self,
|
|||||||
"fundamental period %i frames, minimum period %i frames, maximum period "
|
"fundamental period %i frames, minimum period %i frames, maximum period "
|
||||||
"%i frames", defaultp_frames, fundp_frames, minp_frames, maxp_frames);
|
"%i frames", defaultp_frames, fundp_frames, minp_frames, maxp_frames);
|
||||||
|
|
||||||
if (low_latency) {
|
if (low_latency)
|
||||||
devicep_frames = minp_frames;
|
devicep_frames = minp_frames;
|
||||||
} else {
|
else
|
||||||
/* rate is in Hz, latency_time is in usec */
|
/* Just pick the max period, because lower values can cause glitches
|
||||||
int tmp = (rate * spec->latency_time * GST_USECOND) / GST_SECOND;
|
* https://bugzilla.gnome.org/show_bug.cgi?id=794497 */
|
||||||
devicep_frames = CLAMP (tmp, minp_frames, maxp_frames);
|
devicep_frames = maxp_frames;
|
||||||
/* Ensure it's a multiple of the fundamental period */
|
|
||||||
tmp = devicep_frames / fundp_frames;
|
|
||||||
devicep_frames = tmp * fundp_frames;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
|
stream_flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
|
||||||
if (loopback)
|
if (loopback)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user