summaryrefslogtreecommitdiff
path: root/src/encode.c
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2014-07-14 19:40:53 (GMT)
committerNirbheek Chauhan <nirbheek@centricular.com>2014-07-14 19:49:08 (GMT)
commit5e3b9fc170c77a55003d9d94a71fea6eda88f847 (patch)
tree252d78023594e031566db0aeb0d4c6511de88378 /src/encode.c
parent4ebd3a09a6979bc568459aea842f09d12f4ad4f2 (diff)
downloadsoup-transcoding-proxy-5e3b9fc170c77a55003d9d94a71fea6eda88f847.zip
soup-transcoding-proxy-5e3b9fc170c77a55003d9d94a71fea6eda88f847.tar.gz
Improve latency by waiting for the next keyframe
Instead of caching all the data from the previous keyframe till right now and sending it to the client in a burst, since latency is important, we instead wait for the next keyframe before sending buffers to the clients. This will lead to a delay of upto 128 frames before the stream starts. The keyframe distance and hence the delay can be tweaked by setting the "keyframe-max-dist" property on vp8enc in src/encode.c:create_webm_profile()
Diffstat (limited to 'src/encode.c')
-rw-r--r--src/encode.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/src/encode.c b/src/encode.c
index 4054c89..5e33980 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -95,27 +95,6 @@ out:
return;
}
-static void
-update_keyframe_buffer_cb (GstElement *fakesink,
- GstBuffer *buffer,
- GstPad *pad,
- TranscodeServerCtx *ctx)
-{
- if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DECODE_ONLY) ||
- GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_CORRUPTED) ||
- GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_GAP) ||
- GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DROPPABLE))
- return;
-
- if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT))
- gst_buffer_list_foreach (ctx->keyframe,
- stp_unref_gst_buffer, NULL);
-
- gst_buffer_ref (buffer);
- gst_buffer_list_add (ctx->keyframe, buffer);
- return;
-}
-
static GstEncodingProfile *
create_webm_profile (void)
{
@@ -197,8 +176,7 @@ stp_encode_from_msg (TranscodeServerCtx *ctx)
/* Ensure that the stream is always realtime */
g_object_set (fakesink,
- "sync", TRUE,
- "signal-handoffs", TRUE, NULL);
+ "sync", TRUE, NULL);
gst_bin_add_many (GST_BIN (ctx->pipeline), encodebin, tee, q1, fakesink, NULL);
gst_element_link_many (encodebin, tee, q1, fakesink, NULL);
@@ -228,11 +206,6 @@ stp_encode_from_msg (TranscodeServerCtx *ctx)
g_free (tmp);
#endif
- ctx->keyframe = gst_buffer_list_new ();
-
- g_signal_connect (fakesink, "handoff",
- G_CALLBACK (update_keyframe_buffer_cb), ctx);
-
/* The pads of decodebin and encodebin are dynamic,
* so those will be linked when streams/pads are added */