diff --git a/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c b/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c index 7d9d7208fa..afe61b8335 100644 --- a/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c +++ b/subprojects/gst-plugins-bad/sys/ipcpipeline/gstipcpipelinecomm.c @@ -28,10 +28,9 @@ # include #endif #ifdef _MSC_VER -/* ssize_t is not available, so match return value of read()/write() on MSVC */ -#define ssize_t int -/* read, write */ -#include +/* ssize_t is not available, so match return value of recv()/send() on MSVC */ +# define ssize_t int +# include #endif #include #include @@ -230,6 +229,20 @@ write_to_fd_raw (GstIpcPipelineComm * comm, const void *data, size_t size) GST_TRACE_OBJECT (comm->element, "Writing %u bytes to fdout", (unsigned) size); while (size) { +#ifdef _MSC_VER + ssize_t written = + send (comm->fdout, (const unsigned char *) data + offset, size, 0); + if (written < 0) { + int last_error = WSAGetLastError (); + if (last_error == WSAEWOULDBLOCK) + continue; + gchar *error_text = g_win32_error_message (last_error); + GST_ERROR_OBJECT (comm->element, "Failed to write to fd: %s", error_text); + g_free (error_text); + ret = FALSE; + goto done; + } +#else ssize_t written = write (comm->fdout, (const unsigned char *) data + offset, size); if (written < 0) { @@ -240,6 +253,7 @@ write_to_fd_raw (GstIpcPipelineComm * comm, const void *data, size_t size) ret = FALSE; goto done; } +#endif size -= written; offset += written; } @@ -1754,7 +1768,19 @@ again: mem = gst_allocator_alloc (NULL, comm->read_chunk_size, NULL); gst_memory_map (mem, &map, GST_MAP_WRITE); +#ifdef _MSC_VER + sz = recv (comm->pollFDin.fd, map.data, map.size, 0); + if (sz < 0) { + int last_error = WSAGetLastError (); + if (last_error == WSAEWOULDBLOCK) { + errno = EAGAIN; + } else { + errno = last_error; + } + } +#else sz = read (comm->pollFDin.fd, map.data, map.size); +#endif gst_memory_unmap (mem, &map); if (sz <= 0) { diff --git a/subprojects/gst-plugins-bad/sys/ipcpipeline/meson.build b/subprojects/gst-plugins-bad/sys/ipcpipeline/meson.build index 8d449a020a..79174c6eaa 100644 --- a/subprojects/gst-plugins-bad/sys/ipcpipeline/meson.build +++ b/subprojects/gst-plugins-bad/sys/ipcpipeline/meson.build @@ -15,7 +15,7 @@ gstipcpipeline = library('gstipcpipeline', ipcpipeline_sources, c_args : gst_plugins_bad_args, include_directories : [configinc], - dependencies : [gstbase_dep], + dependencies : [gstbase_dep] + winsock2, install : true, install_dir : plugins_install_dir, )