diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-14 15:46:39 (GMT) |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-14 15:46:40 (GMT) |
commit | df0f28945f2c32f519457e838eb424401eb586e9 (patch) | |
tree | 0069fb922da82ac01f0fa3a0eea572da7f863d35 /src/main.c | |
parent | feee319e6b6cb4774cce72d90d1a60f5ecc9bbda (diff) | |
download | soup-transcoding-proxy-df0f28945f2c32f519457e838eb424401eb586e9.zip soup-transcoding-proxy-df0f28945f2c32f519457e838eb424401eb586e9.tar.gz |
server: Always send data from the last keyframe
Store non-keyframe buffers sent to fakesink, and push them to all new clients
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -224,7 +224,7 @@ GET: { /* A GET request was received. We connect from the pipeline to the * client requesting the stream and start writing the response. */ - GstCaps *caps; + GstCaps *caps = NULL; GstState state; GstBuffer *buffer; GstFlowReturn ret; @@ -293,7 +293,7 @@ GET: if (!gst_element_sync_state_with_parent (bin)) { g_critical ("Unable to sync appsink bin with parent pipeline\n"); - return; + goto err; } g_debug ("appsink bin state synced successfully\n"); @@ -308,12 +308,21 @@ GET: buffer = stp_get_streamheader_from_caps (caps); if (!buffer) { g_printerr ("Unable to get streamheader from caps\n"); - goto nostreamheader; + goto push_keyframe; } ret = gst_pad_push (srcpad, buffer); if (ret != GST_FLOW_OK) { - g_printerr ("Unable to push buffer: %s\n", + g_printerr ("Unable to push streamheader: %s\n", + gst_flow_get_name (ret)); + goto err; + } + +push_keyframe: + ret = gst_pad_push_list (srcpad, + gst_buffer_list_copy (server_ctx->keyframe)); + if (ret != GST_FLOW_OK) { + g_printerr ("Unable to push keyframe data: %s\n", gst_flow_get_name (ret)); goto err; } @@ -324,11 +333,6 @@ GET: gst_element_state_change_return_get_name (state_change), gst_element_state_get_name (state)); -nostreamheader: - gst_object_unref (template); - gst_object_unref (srcpad); - gst_object_unref (tee); - client_ctx->appsink = appsink; g_signal_connect (appsink, "new-sample", @@ -350,7 +354,11 @@ nostreamheader: soup_message_set_status (msg, SOUP_STATUS_OK); out: - gst_caps_unref (caps); + gst_object_unref (template); + gst_object_unref (srcpad); + gst_object_unref (tee); + if (caps) + gst_caps_unref (caps); return; err: soup_message_set_status (client_ctx->msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); |