diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -134,6 +134,15 @@ invoke_write_client_chunk (TranscodeClientCtx *ctx) } buffer = gst_sample_get_buffer (sample); + + /* Skip all frames till the next keyframe */ + if (!ctx->keyframe_found && + GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) { + gst_sample_unref (sample); + return FALSE; + } + ctx->keyframe_found = TRUE; + gst_buffer_map (buffer, &info, GST_MAP_READ); soup_message_body_append (ctx->msg->response_body, SOUP_MEMORY_COPY, @@ -151,7 +160,7 @@ static GstFlowReturn write_client_chunk_cb (GstElement *appsink, TranscodeClientCtx *ctx) { - g_main_context_invoke_full (NULL, G_PRIORITY_HIGH, + g_main_context_invoke_full (NULL, G_PRIORITY_DEFAULT, (GSourceFunc)invoke_write_client_chunk, ctx, NULL); return GST_FLOW_OK; @@ -227,7 +236,6 @@ GET: /* A GET request was received. We connect from the pipeline to the * client requesting the stream and start writing the response. */ GstCaps *caps = NULL; - GstState state; GstBuffer *buffer; GstFlowReturn ret; GstStateChangeReturn state_change; @@ -311,7 +319,7 @@ GET: buffer = stp_get_streamheader_from_caps (caps); if (!buffer) { g_critical ("Unable to get streamheader from caps"); - goto push_keyframe; + goto nostreamheader; } ret = gst_pad_push (srcpad, buffer); @@ -321,21 +329,7 @@ GET: goto err; } -push_keyframe: - ret = gst_pad_push_list (srcpad, - gst_buffer_list_copy (server_ctx->keyframe)); - if (ret != GST_FLOW_OK) { - g_critical ("Unable to push keyframe data: %s", - gst_flow_get_name (ret)); - goto err; - } - - state_change = gst_element_get_state (server_ctx->pipeline, - &state, NULL, 1); - g_debug ("Pushed buffer. State was %s:%s.", - gst_element_state_change_return_get_name (state_change), - gst_element_state_get_name (state)); - +nostreamheader: client_ctx->appsink = appsink; g_signal_connect (appsink, "new-sample", |