From 01d98fdb5d86ac4072afae25e6c600bb42bbb33f Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Tue, 16 Jun 2009 19:04:54 +0200 Subject: [PATCH] rtsp: Write as much as possible in gst_rtsp_source_dispatch(). Try to write as much as possible if there are multiple messages queued. --- gst-libs/gst/rtsp/gstrtspconnection.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 44f65c5..eee292d 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -3060,7 +3060,7 @@ gst_rtsp_source_dispatch (GSource * source, GSourceFunc callback G_GNUC_UNUSED, res = write_bytes (watch->writefd.fd, watch->write_data, &watch->write_off, watch->write_size); if (res == GST_RTSP_EINTR) - break; + goto write_blocked; else if (G_LIKELY (res == GST_RTSP_OK)) { if (watch->funcs.message_sent) watch->funcs.message_sent (watch, watch->write_id, watch->user_data); @@ -3072,17 +3072,19 @@ gst_rtsp_source_dispatch (GSource * source, GSourceFunc callback G_GNUC_UNUSED, goto error; } - done: - if (g_async_queue_length (watch->messages) == 0 && watch->write_added) { - g_source_remove_poll ((GSource *) watch, &watch->writefd); - watch->write_added = FALSE; - watch->writefd.revents = 0; - } g_free (watch->write_data); watch->write_data = NULL; - } while (FALSE); + } while (TRUE); + + done: + if (watch->write_added) { + g_source_remove_poll ((GSource *) watch, &watch->writefd); + watch->write_added = FALSE; + watch->writefd.revents = 0; + } } +write_blocked: return TRUE; /* ERRORS */ -- 2.7.4