From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: dccp@vger.kernel.org
Subject: Re: Gstreamer e DCCP: issues related to ccid-3
Date: Thu, 25 Oct 2007 10:29:25 +0000 [thread overview]
Message-ID: <200710251129.25237@strip-the-willow> (raw)
In-Reply-To: <5bc4c4570710242047h1d9b1c64k6381ba5c3a421355@mail.gmail.com>
| Basically the functions that I'm using to send are the following:
|
| PS: the second function, gst_dccp_send_buffer, is a call back function
| called by gstreamer when it has data to be sent. Thank you.
| /* write buffer to given socket incrementally.
| * Returns number of bytes written.
| */
| gint
| gst_dccp_socket_write (int socket, const void *buf, size_t count)
| {
| size_t bytes_written = 0;
| ssize_t wrote;
|
| while (bytes_written < count) {
| wrote = send (socket, (const char *) buf + bytes_written,
| count - bytes_written, MSG_NOSIGNAL);
| if (wrote <= 0) {
| return bytes_written;
| }
| bytes_written += wrote;
| }
/* something like (but do have a look at the paraslash sources)
do {
wrote = send (socket, (const char *) buf + bytes_written,
count - bytes_written, MSG_NOSIGNAL);
} while (wrote < 0 && errno = EAGAIN);
*/
If the function below is a callback, then this may be tricky, since
the solution is to poll (the above do..while loop), until there is
room in the sender's TX queue.
In principle, you could use the same do..while loop, or decide to
store the chunk back into a list and reschedule the callback to
"call later", as it is done in the paraslash sources.
|
| /* write a GDP header to the socket. Return false if fails. */
| GstFlowReturn
| gst_dccp_send_buffer (GstElement * this, GstBuffer * buffer, int socket)
| {
| size_t wrote;
|
| gint size = 0;
| guint8 *data;
|
| size = GST_BUFFER_SIZE (buffer);
| data = GST_BUFFER_DATA (buffer);
|
| GST_LOG_OBJECT (this, "writing %d bytes for GDP buffer header\n", size);
| printf("writing %d bytes for GDP buffer header\n\n", size);
| wrote = gst_dccp_socket_write (socket, data, size);
| //g_free (data);
|
| if (wrote != size) {
| GST_ELEMENT_ERROR (this, CORE, TOO_LAZY, (NULL),
| ("Error while sending data"));
| printf("Error while sending data\n");
| return GST_FLOW_ERROR;
| }
|
| return GST_FLOW_OK;
| }
|
next prev parent reply other threads:[~2007-10-25 10:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-25 3:47 Gstreamer e DCCP: issues related to ccid-3 Łeandro Sales
2007-10-25 10:17 ` Gerrit Renker
2007-10-25 10:29 ` Gerrit Renker [this message]
2007-10-25 17:14 ` Ian McDonald
2007-11-01 4:13 ` Łeandro Sales
2007-11-01 9:48 ` Gerrit Renker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200710251129.25237@strip-the-willow \
--to=gerrit@erg.abdn.ac.uk \
--cc=dccp@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.