diff options
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); |