summaryrefslogtreecommitdiff
path: root/sys/wasapi
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-11-25 21:16:05 +0530
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2019-11-28 08:59:41 +0000
commit5d9c060ca7dfab93cd154b16e0c0bba7a5d815bf (patch)
treed03e8dcbda69028be5d7ef1681b4546cd304cca1 /sys/wasapi
parent6d27c0ac08a4071353e95f8fdc2ff97603f39bce (diff)
downloadgstreamer-plugins-bad-5d9c060ca7dfab93cd154b16e0c0bba7a5d815bf.tar.gz
wasapisrc: Clarify that nBlockAlign is actually bpf
bpf = bytes per frame.
Diffstat (limited to 'sys/wasapi')
-rw-r--r--sys/wasapi/gstwasapisrc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/wasapi/gstwasapisrc.c b/sys/wasapi/gstwasapisrc.c
index 752624669..47e7d0229 100644
--- a/sys/wasapi/gstwasapisrc.c
+++ b/sys/wasapi/gstwasapisrc.c
@@ -555,6 +555,7 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
HRESULT hr;
gint16 *from = NULL;
guint wanted = length;
+ guint bpf;
DWORD flags;
GST_OBJECT_LOCK (self);
@@ -564,6 +565,8 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
GST_OBJECT_UNLOCK (self); goto err);
self->client_needs_restart = FALSE;
}
+
+ bpf = self->mix_format->nBlockAlign;
GST_OBJECT_UNLOCK (self);
while (wanted > 0) {
@@ -603,7 +606,7 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
if (flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY)
GST_WARNING_OBJECT (self, "WASAPI reported glitch in buffer");
- want_frames = wanted / self->mix_format->nBlockAlign;
+ want_frames = wanted / bpf;
/* If GetBuffer is returning more frames than we can handle, all we can do is
* hope that this is temporary and that things will settle down later. */
@@ -613,14 +616,11 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
/* Only copy data that will fit into the allocated buffer of size @length */
n_frames = MIN (have_frames, want_frames);
- read_len = n_frames * self->mix_format->nBlockAlign;
+ read_len = n_frames * bpf;
- {
- guint bpf = self->mix_format->nBlockAlign;
- GST_DEBUG_OBJECT (self, "have: %i (%i bytes), can read: %i (%i bytes), "
- "will read: %i (%i bytes)", have_frames, have_frames * bpf,
- want_frames, wanted, n_frames, read_len);
- }
+ GST_DEBUG_OBJECT (self, "have: %i (%i bytes), can read: %i (%i bytes), "
+ "will read: %i (%i bytes)", have_frames, have_frames * bpf,
+ want_frames, wanted, n_frames, read_len);
memcpy (data, from, read_len);
wanted -= read_len;