Having trouble getting more than one chunk sent with chunked encoding



Hi,

I'm trying to stream a chunked response in a SoupMessage taken from a
Gstreamer pipeline. This is the same case of my other email about
SoupMultipart. I am temporarily using the multipartmux Gstreamer
element to do the actual multipart encoding so I just need libsoup to
stream the bits in the response. I can get the response all setup and
the first chunk sent but after that no other chunk gets sent although
I'm unpausing the message. The app just seems to sit there buffering
the chunks (consuming memory) and the HTTP client doesn't receive
anything.

My only hypothesis is that somehow having libsoup and Gstreamer on the
same mainloop is causing issues. You can see the whole code here:

https://github.com/pedrocr/camerasink/blob/309285054681f70214ebb22596d4f5551a9574f5/bin/camerasave.c

My send_chunk function seems pretty straightforward:

static void send_chunk (gpointer key, gpointer value, gpointer user_data) {
  GstBuffer *buffer = (GstBuffer *) user_data;
  SoupMessage *msg = SOUP_MESSAGE(key);
  SoupServer *server = SOUP_SERVER(value);
  GstMapInfo map;

  gst_buffer_map (buffer, &map, GST_MAP_READ);
  //g_print ("[%p] writing chunk of %lu bytes\n", msg, (unsigned
long)chunk->length);
  soup_message_body_append (msg->response_body, SOUP_MEMORY_COPY,
map.data, map.size);
  gst_buffer_unmap (buffer, &map);

  soup_server_unpause_message (server, msg);
}

The first chunk gets sent and I get a wrote-chunk signal. After that
the program just sits there eating memory and no other wrote-chunk
signals are sent and indeed the HTTP client doesn't see the response
continuing.

Any pointers would be very welcome.

Pedro


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]