mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
wasapisrc: Correctly handle BUFFERFLAGS_SILENT
We need to ignore the data we get from WASAPI in this case and write out silence (zeroes). Initially reported at https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/808
This commit is contained in:
parent
08d5bdc7b5
commit
d6471b0251
1 changed files with 6 additions and 5 deletions
|
@ -609,10 +609,6 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
|
|||
goto err);
|
||||
}
|
||||
|
||||
/* XXX: How do we handle AUDCLNT_BUFFERFLAGS_SILENT? We're supposed to write
|
||||
* out silence when that flag is set? See:
|
||||
* https://msdn.microsoft.com/en-us/library/windows/desktop/dd370800(v=vs.85).aspx */
|
||||
|
||||
if (G_UNLIKELY (flags != 0)) {
|
||||
/* https://docs.microsoft.com/en-us/windows/win32/api/audioclient/ne-audioclient-_audclnt_bufferflags */
|
||||
if (flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY)
|
||||
|
@ -623,9 +619,14 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
|
|||
|
||||
/* Copy all the frames we got into the adapter, and then extract at most
|
||||
* @wanted size of frames from it. This helps when ::GetBuffer returns more
|
||||
* data than we can handle right now */
|
||||
* data than we can handle right now. */
|
||||
{
|
||||
GstBuffer *tmp = gst_buffer_new_allocate (NULL, got_frames * bpf, NULL);
|
||||
/* If flags has AUDCLNT_BUFFERFLAGS_SILENT, we will ignore the actual
|
||||
* data and write out silence, see:
|
||||
* https://docs.microsoft.com/en-us/windows/win32/api/audioclient/ne-audioclient-_audclnt_bufferflags */
|
||||
if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
|
||||
memset (from, 0, got_frames * bpf);
|
||||
gst_buffer_fill (tmp, 0, from, got_frames * bpf);
|
||||
gst_adapter_push (self->adapter, tmp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue