summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index c489f55..2d3e537 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,6 +21,7 @@
*/
#include <glib-unix.h>
+#include <gst/video/video.h>
#include "lib.h"
#include "encode.h"
@@ -240,10 +241,11 @@ 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;
+ GstEvent *event;
GstBuffer *buffer;
GstFlowReturn ret;
GstStateChangeReturn state_change;
- GstElement *bin, *tee, *q2, *appsink;
+ GstElement *encodebin, *bin, *tee, *q2, *appsink;
GstPadTemplate *template;
GstPad *srcpad, *sinkpadq2;
TranscodeClientCtx *client_ctx;
@@ -322,7 +324,7 @@ GET:
buffer = stp_get_streamheader_from_caps (caps);
if (!buffer) {
g_critical ("Unable to get streamheader from caps");
- goto nostreamheader;
+ goto force_key_unit;
}
ret = gst_pad_push (srcpad, buffer);
@@ -332,7 +334,17 @@ GET:
goto err;
}
-nostreamheader:
+force_key_unit:
+ encodebin = gst_bin_get_by_name (GST_BIN (server_ctx->pipeline),
+ "encodebin");
+ event = gst_video_event_new_downstream_force_key_unit (GST_CLOCK_TIME_NONE,
+ GST_CLOCK_TIME_NONE,
+ GST_CLOCK_TIME_NONE,
+ FALSE, 1);
+ if (!gst_element_send_event (encodebin, event))
+ g_critical ("Couldn't send upstream key unit event!");
+ gst_object_unref (encodebin);
+
client_ctx->appsink = appsink;
g_signal_connect (appsink, "new-sample",