Commit graph

36 commits

Author SHA1 Message Date
Andoni Morales Alastruey
7c6d9c2725 gstpoll: retry reading the control socket to release properly all wakeups
if set->control_pending is set to 0 but we didn't not succed reading
the control socket, future calls to gst_poll_wait() will be awaiken
by the control socket which will not be released properly because
set->control_pending is already 0, causing an infinite loop.
2011-04-04 11:05:45 +02:00
Thomas Kristensen
d0d27e83fe poll: don't call WSAWaitForMultipleEvents with no events
Fixes error caught by Microsoft Application Verifier.
2011-04-04 09:23:57 +02:00
Jason D. Clinton
a789096c04 build: fix build with -Werror with GCC 4.6.0
This touches three areas of code, removes unused variables and discards
return values from two functions with (void).

https://bugzilla.gnome.org/show_bug.cgi?id=645267
2011-03-21 09:29:19 +01:00
Mark Nauwelaerts
50d566d9ad poll: trigger rebuild setup in _new
Failing to do so in the Windows case (implicitly triggered otherwise)
would have a subsequent _wait return immediately leading to high CPU
usage timeout loops.

Fixes #640675.
2011-02-03 15:52:18 +01:00
Raimo Järvi
0645c498f0 gstpoll: fix compiler warning with MingW
gstpoll.c: In function 'gst_poll_get_read_gpollfd':
gstpoll.c:692:10: warning: assignment makes integer from pointer without a cast

https://bugzilla.gnome.org/show_bug.cgi?id=638900
2011-01-11 12:47:49 +00:00
Edward Hervey
4f94b94bff gstpoll: Fix for (p)select backend
We need to reset the revents field of each pollfd when reading the results
from select else we'll end up with stray info from previous calls to
select.
2011-01-03 20:37:59 +01:00
Tim-Philipp Müller
3256c708be docs: gst: more gobject introspection annotations
Many of these are superfluous, added for clarity.
2010-12-07 18:37:04 +00:00
Wim Taymans
8bf6b0c3fe poll: return wakeup event in GPollFD 2010-12-06 11:20:35 +01:00
Wim Taymans
77830123cf poll: small cleanups 2010-12-03 15:50:38 +01:00
Wim Taymans
9bf56084cf poll: make sure we remove the readfd messages 2010-12-03 15:50:38 +01:00
Wim Taymans
35d10af06d poll: add method to get a GPollFD 2010-12-03 15:50:38 +01:00
Wim Taymans
22fa4470e2 poll: Refactor and make more lockfree
Refactor the wakeup of the poll thread.
Always make a control socket to make things easier.
Make more methods lockfree.
2010-12-03 15:50:38 +01:00
Wim Taymans
e266d4d397 poll: move lock to where it makes more sense 2010-12-03 15:50:38 +01:00
Wim Taymans
73ee14302f poll: make timer polls lockfree
Make sure we don't take a mutex in the normal code path of the timer
poll.
2010-12-03 15:50:38 +01:00
Tim-Philipp Müller
4cbf794b0e gstpoll: don't pass non-objects as first argument to GST_DEBUG_OBJECT()
This may cause crashes when logging is enabled, especially on windows.
It's not safe to pass random pointers to g_type_check_instance_is_a().

Fixes #611719.
2010-03-04 18:40:50 +00:00
Edward Hervey
edce400c79 gstpoll: Only take into account active fds
This is needed so that select properly errors out on macosx (sigh)
2009-10-12 12:01:59 +02:00
Edward Hervey
dc3fb58a90 gstpoll: Add some debugging statements 2009-10-12 10:07:03 +02:00
Edward Hervey
3254f19c6f gstpoll: Use the error fdset when using select/pselect.
This is needed to properly detect fds that are closed or that got
an error
2009-10-12 10:01:01 +02:00
Edward Hervey
95413683fa gstpoll: Don't use poll on systems with broken poll 2009-10-12 09:53:58 +02:00
Edward Hervey
0fc16a8e74 gst: Add debugging category GST_POLL for gstpoll 2009-10-12 09:50:00 +02:00
Peter Kjellerstedt
7be99f052b gstpoll: Corrected a documentation typo. 2009-03-26 19:33:41 +01:00
Jan Schmidt
31669a4819 gstpoll: Fix up documentation strings.
Note the changed behaviour of gst_poll_wait for timer GstPoll's, and
fix a couple of spelling errors.
2009-03-26 15:06:16 +00:00
LRN
e13168bd4b GstPoll: set the return value on windows
Make sure that the return value of the functions _read/_write_control()
return the actual result instead of always FALSE on windows.
Fixes #574211.
2009-03-05 11:02:59 +01:00
Wim Taymans
5cfb02af4a GstPoll: add methods to use gstpoll for timeouts
Add a special timer mode in GstPoll that makes it only use the control socket
with a timeout to schedule timeouts. Also add a pair of methods to wakeup the
timeout thread.
API: GstPoll::gst_poll_new_timer()
API: GstPoll::gst_poll_write_control()
API: GstPoll::gst_poll_read_control()
2009-02-03 17:49:02 +01:00
Wim Taymans
0f55cf13b4 Avoid unneeded reads from the control socket
Add a new variable that keeps track of the status of the control socket. This
allows us to avoid doing a read() on the control socket when we did not write
anything to it.
Fixes #568438.
2009-01-26 12:52:12 +01:00
이문형
67edb154e5 gst/gstpoll.c: Adds support for FD_CONNECT event (win32). See #562258.
Original commit message from CVS:
Patch by: 이문형 <iwings at gmail dot com>
* gst/gstpoll.c: (gst_poll_fd_ctl_write), (gst_poll_fd_has_error):
Adds support for FD_CONNECT event (win32). See #562258.
2008-11-27 11:12:30 +00:00
Wim Taymans
3cc67ebab7 gst/gstbuffer.c: Avoid costly typechecking for trivially correct pointers.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_finalize):
Avoid costly typechecking for trivially correct pointers.
* gst/gstpoll.c: (gst_poll_wait):
Add some G_LIKELY here and there.
* libs/gst/base/gstadapter.c: (gst_adapter_push):
Add some debug info.
2008-11-13 18:09:45 +00:00
Michael Smith
5b9b2e7779 configure.ac: Remove AC_ISC_POSIX macro; it's broken on some platforms and not needed.
Original commit message from CVS:
* configure.ac:
Remove AC_ISC_POSIX macro; it's broken on some platforms and not needed.
Add check (taken from -base) for winsock, adds WIN32_LIBS
* gst/Makefile.am:
Add WIN32_LIBS to LIBADD for libgstreamer. Needed now that gstpoll uses
winsock.
Define GST_EXPORTS when building libgstreamer (only used on win32)
* gst/gst_private.h:
* gst/gstinfo.h:
Use GST_EXPORT instead of locally-defined (and incorrect IMPORT_SYMBOL)
for symbols that we need to export in both these files.
* gst/gstpoll.c:
Include gst_private.h higher up to avoid some compile problems on win32.
2008-07-22 18:12:54 +00:00
Alessandro Decina
78734e4584 gst/gstpoll.c: Fix "ignored return value" compiler warning with newer glibc.
Original commit message from CVS:
Patch by: Alessandro Decina <alessandro at nnva dot org>
* gst/gstpoll.c:
Fix "ignored return value" compiler warning with newer glibc.
2008-07-06 12:49:43 +00:00
Damien Lespiau
2c3a6718be gst/gstpoll.c: Fix compilation of GstPoll with mingw32. Fixes bug #526236.
Original commit message from CVS:
Patch by: Damien Lespiau <damien dot lespiau at gmail dot com>
* gst/gstpoll.c:
Fix compilation of GstPoll with mingw32. Fixes bug #526236.
2008-04-05 10:58:11 +00:00
Sebastian Dröge
1e0128c47e configure.ac: Require GLib 2.12.
Original commit message from CVS:
* configure.ac:
Require GLib 2.12.
* gst/glib-compat-private.h:
* gst/gstcaps.c: (gst_caps_new_empty), (_gst_caps_free):
* gst/gstclock.c: (gst_clock_entry_new), (_gst_clock_id_free):
Unconditionally use GSlice for allocation.
* gst/gstpoll.c: (gst_poll_new), (gst_poll_free):
* gst/gstsegment.c: (gst_segment_new), (gst_segment_free):
* gst/gststructure.c: (gst_structure_id_empty_new_with_size),
(gst_structure_free):
Use GSlice for allocation.
2008-04-01 13:55:20 +00:00
Ole André Vadla Ravnås
bf20f01fba Add new function gst_poll_fd_ignored() for improved Windows compatibility.
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås
<ole dot andre dot ravnas at tandberg dot com>
* docs/gst/gstreamer-sections.txt:
* gst/gstpoll.c: (gst_poll_winsock_error_to_errno),
(gst_poll_update_winsock_event_mask),
(gst_poll_prepare_winsock_active_sets),
(gst_poll_collect_winsock_events), (gst_poll_new), (gst_poll_free),
(gst_poll_add_fd_unlocked), (gst_poll_fd_ctl_write),
(gst_poll_fd_ctl_read_unlocked), (gst_poll_fd_ignored),
(gst_poll_fd_has_error), (gst_poll_fd_can_read_unlocked),
(gst_poll_check_ctrl_commands), (gst_poll_wait):
* gst/gstpoll.h:
* win32/common/libgstreamer.def:
Add new function gst_poll_fd_ignored() for improved Windows
compatibility.
Various minor fixes and cleanups. See #520808.
2008-03-18 10:54:52 +00:00
Ole André Vadla Ravnås
8a6042989a Remove GstPollMode from the API, it does not make sense to let the application control this.
Original commit message from CVS:
Patch by: Ole André Vadla Ravnås
<ole dot andre dot ravnas at tandberg dot com>
* docs/gst/gstreamer-sections.txt:
* gst/gstpoll.c: (find_index), (gst_poll_free_winsock_event),
(gst_poll_update_winsock_event_mask), (gst_poll_new),
(gst_poll_free), (gst_poll_fd_init), (gst_poll_add_fd_unlocked),
(gst_poll_remove_fd), (gst_poll_fd_ctl_write),
(gst_poll_fd_ctl_read_unlocked), (gst_poll_fd_has_closed),
(gst_poll_fd_has_error), (gst_poll_fd_can_read_unlocked),
(gst_poll_fd_can_write), (gst_poll_wait),
(gst_poll_set_controllable), (gst_poll_restart),
(gst_poll_set_flushing):
* gst/gstpoll.h:
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_new):
* libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_start),
(gst_net_time_provider_new):
* plugins/elements/gstfdsink.c: (gst_fd_sink_start):
* plugins/elements/gstfdsrc.c: (gst_fd_src_start):
* tests/benchmarks/gstpollstress.c: (main):
* tests/check/gst/gstpoll.c: (GST_START_TEST), (gst_poll_suite):
Remove GstPollMode from the API, it does not make sense to let the
application control this.
Add support for Win32.
Fix the testsuite. Fixes #520671.
2008-03-07 15:39:45 +00:00
Wim Taymans
a7bc443923 gst/gstpoll.*: Added Since tags.
Original commit message from CVS:
* gst/gstpoll.c: (gst_poll_fd_init):
* gst/gstpoll.h:
Added Since tags.
* plugins/elements/gstfdsink.c: (gst_fd_sink_update_fd):
Use some more init macros.
2008-02-29 11:57:42 +00:00
Wim Taymans
3ae60c3b9d Add INIT macro and _init method for initializing the GstPollFD.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstpoll.c: (gst_poll_fd_init):
* gst/gstpoll.h:
Add INIT macro and _init method for initializing the GstPollFD.
2008-02-29 11:00:43 +00:00
Wim Taymans
d37ee60f47 configure.ac: Add checks for poll, ppoll and pselect.
Original commit message from CVS:
* configure.ac:
Add checks for poll, ppoll and pselect.
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
Add docs for GstPoll.
* gst/Makefile.am:
* gst/gst.h:
* gst/gstpoll.c: (find_index), (selectable_fds),
(pollable_timeout), (choose_mode), (pollfd_to_fd_set),
(fd_set_to_pollfd), (gst_poll_new), (gst_poll_free),
(gst_poll_set_mode), (gst_poll_get_mode),
(gst_poll_add_fd_unlocked), (gst_poll_add_fd),
(gst_poll_remove_fd), (gst_poll_fd_ctl_write),
(gst_poll_fd_ctl_read_unlocked), (gst_poll_fd_ctl_read),
(gst_poll_fd_has_closed), (gst_poll_fd_has_error),
(gst_poll_fd_can_read_unlocked), (gst_poll_fd_can_read),
(gst_poll_fd_can_write), (gst_poll_wait),
(gst_poll_set_controllable), (gst_poll_restart),
(gst_poll_set_flushing):
* gst/gstpoll.h:
Add generic poll abstraction. We ideally don't want to have this in core
here but in glib intead...
This code will be used in various network elements and ultimately for
the nanosecond precision monotonic clock (that's why it's here in core).
It'll allow us to implement cancelable socket operations for windows too.
* tests/check/Makefile.am:
* tests/check/gst/gstpoll.c: (test_poll_wait), (GST_START_TEST),
(delayed_stop), (delayed_restart), (delayed_flush),
(delayed_control), (gst_poll_suite):
Add GstPoll unit test.
2008-02-27 18:00:04 +00:00