poll: set_controllable(), restart() and set_flushing() are only valid for non-timer GstPolls

On timer GstPolls it will cause the control socket state to become
inconsistent as now one less read_control() than write_control() be would
needed.

Similarly, read_control() and write_control() are only valid on timer
GstPolls.

https://bugzilla.gnome.org/show_bug.cgi?id=750397
This commit is contained in:
Sebastian Dröge 2016-06-29 13:26:57 +02:00
parent 0bfc9fb212
commit 254955df62

View file

@ -1547,12 +1547,16 @@ winsock_error:
* gst_poll_wait() will be affected by gst_poll_restart() and
* gst_poll_set_flushing().
*
* This function only works for non-timer #GstPoll objects created with
* gst_poll_new().
*
* Returns: %TRUE if the controllability of @set could be updated.
*/
gboolean
gst_poll_set_controllable (GstPoll * set, gboolean controllable)
{
g_return_val_if_fail (set != NULL, FALSE);
g_return_val_if_fail (!set->timer, FALSE);
GST_LOG ("%p: controllable : %d", set, controllable);
@ -1569,11 +1573,15 @@ gst_poll_set_controllable (GstPoll * set, gboolean controllable)
* used after adding or removing descriptors to @set.
*
* If @set is not controllable, then this call will have no effect.
*
* This function only works for non-timer #GstPoll objects created with
* gst_poll_new().
*/
void
gst_poll_restart (GstPoll * set)
{
g_return_if_fail (set != NULL);
g_return_if_fail (!set->timer);
if (set->controllable && GET_WAITING (set) > 0) {
/* we are controllable and waiting, wake up the waiter. The socket will be
@ -1591,11 +1599,15 @@ gst_poll_restart (GstPoll * set)
* to gst_poll_wait() will return -1, with errno set to EBUSY.
*
* Unsetting the flushing state will restore normal operation of @set.
*
* This function only works for non-timer #GstPoll objects created with
* gst_poll_new().
*/
void
gst_poll_set_flushing (GstPoll * set, gboolean flushing)
{
g_return_if_fail (set != NULL);
g_return_if_fail (!set->timer);
GST_LOG ("%p: flushing: %d", set, flushing);
@ -1623,6 +1635,9 @@ gst_poll_set_flushing (GstPoll * set, gboolean flushing)
* gst_poll_read_control() have been performed, calls to gst_poll_wait() will
* block again until their timeout expired.
*
* This function only works for timer #GstPoll objects created with
* gst_poll_new_timer().
*
* Returns: %TRUE on success. %FALSE when @set is not controllable or when the
* byte could not be written.
*/
@ -1644,7 +1659,8 @@ gst_poll_write_control (GstPoll * set)
* @set: a #GstPoll.
*
* Read a byte from the control socket of the controllable @set.
* This function is mostly useful for timer #GstPoll objects created with
*
* This function only works for timer #GstPoll objects created with
* gst_poll_new_timer().
*
* Returns: %TRUE on success. %FALSE when @set is not controllable or when there