aboutsummaryrefslogtreecommitdiffstats
path: root/src/wth-receiver-gst-shm.c
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-11-02 16:51:08 +0200
committerMarius Vlad <marius.vlad@collabora.com>2020-12-01 13:07:57 +0200
commit8fcbed84cfefcfe648584941587e6d06abf59c3e (patch)
tree4a370a19465e12543e74563fc136cf916554ca6f /src/wth-receiver-gst-shm.c
parent2373db4b31a646d4936f6700ecc2af857302444b (diff)
wth-receiver: Handle events from the remote side and from the local compositor
With this, we fork and let the child deal with the gstreamer pipeline while the parent is still able to process events from the transimtter. Using blocking dispatching function will make the main loop be stuck in processing events without being able to dispatch any handlers that might be due to the requests from the transmistter side. So in order to allow the mainloop (still) handle the events, we fork and let child deal with the gstreamer pipeline. Bug-AGL: SPEC-3675 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I50e1d49b55849dc32f611538bad2ce1c676c9a97
Diffstat (limited to 'src/wth-receiver-gst-shm.c')
-rw-r--r--src/wth-receiver-gst-shm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wth-receiver-gst-shm.c b/src/wth-receiver-gst-shm.c
index 2228d4f..50efe0b 100644
--- a/src/wth-receiver-gst-shm.c
+++ b/src/wth-receiver-gst-shm.c
@@ -815,7 +815,7 @@ wth_receiver_weston_main(struct window *window, const char *app_id, int port)
memset(pipeline, 0x00, sizeof(pipeline));
snprintf(pipeline, sizeof(pipeline), pipe, port);
- fprintf(stdout, "pipeline %s\n", pipeline);
+ fprintf(stdout, "Using pipeline %s\n", pipeline);
/* parse the pipeline */
gstctx.pipeline = gst_parse_launch(pipeline, &gerror);
@@ -836,7 +836,6 @@ wth_receiver_weston_main(struct window *window, const char *app_id, int port)
while (running && ret != -1)
ret = wl_display_dispatch(gstctx.display->display);
-
gst_element_set_state(gstctx.pipeline, GST_STATE_NULL);
gst_object_unref(gstctx.pipeline);
@@ -844,5 +843,10 @@ wth_receiver_weston_main(struct window *window, const char *app_id, int port)
destroy_display(gstctx.display);
free(gargv);
- return 0;
+ fprintf(stdout, "Exiting, closed down gstreamer pipeline\n");
+ /* note, we do a exit here because wth_receiver_weston_main() isn't
+ * really C's main() and we fork() before calling this. Doing a return
+ * will not correctly signal the parent that the child process exited
+ */
+ exit(EXIT_SUCCESS);
}