mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
wasapi: Handle return value of WaitForSingleObject
The wait could've failed for whatever reason, we should handle that.
This commit is contained in:
parent
0a518c9be1
commit
5409cd4920
2 changed files with 16 additions and 2 deletions
|
@ -616,9 +616,16 @@ gst_wasapi_sink_write (GstAudioSink * asink, gpointer data, guint length)
|
|||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
while (pending > 0) {
|
||||
DWORD dwWaitResult;
|
||||
guint can_frames, have_frames, n_frames, write_len;
|
||||
|
||||
WaitForSingleObject (self->event_handle, INFINITE);
|
||||
dwWaitResult = WaitForSingleObject (self->event_handle, INFINITE);
|
||||
if (dwWaitResult != WAIT_OBJECT_0) {
|
||||
GST_ERROR_OBJECT (self, "Error waiting for event handle: %x",
|
||||
(guint) dwWaitResult);
|
||||
length -= pending;
|
||||
goto beach;
|
||||
}
|
||||
|
||||
/* We have N frames to be written out */
|
||||
have_frames = pending / (self->mix_format->nBlockAlign);
|
||||
|
|
|
@ -565,10 +565,17 @@ gst_wasapi_src_read (GstAudioSrc * asrc, gpointer data, guint length,
|
|||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
while (wanted > 0) {
|
||||
DWORD dwWaitResult;
|
||||
guint have_frames, n_frames, want_frames, read_len;
|
||||
|
||||
/* Wait for data to become available */
|
||||
WaitForSingleObject (self->event_handle, INFINITE);
|
||||
dwWaitResult = WaitForSingleObject (self->event_handle, INFINITE);
|
||||
if (dwWaitResult != WAIT_OBJECT_0) {
|
||||
GST_ERROR_OBJECT (self, "Error waiting for event handle: %x",
|
||||
(guint) dwWaitResult);
|
||||
length = 0;
|
||||
goto beach;
|
||||
}
|
||||
|
||||
hr = IAudioCaptureClient_GetBuffer (self->capture_client,
|
||||
(BYTE **) & from, &have_frames, &flags, NULL, NULL);
|
||||
|
|
Loading…
Reference in a new issue