diff options
-rw-r--r-- | src/main.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -114,6 +114,7 @@ write_next_client_chunk_cb (SoupMessage *msg, GstMemory *memory; gboolean eos; + g_print ("*"); g_signal_emit_by_name (ctx->appsink, "pull-sample", &sample); if (!sample) { g_print ("Null sample, ending stream\n"); @@ -160,10 +161,26 @@ static void client_finished_cb (SoupMessage *msg, TranscodeClientCtx *ctx) { + g_print ("Client finished/aborted, doing cleanup...\n"); stp_cleanup_transcode_client_ctx (ctx); } static void +stream_finished_cb (SoupMessage *msg, + TranscodeServerCtx *ctx) +{ + gboolean ret; + + g_print ("Stream finished/aborted, sending EOS...\n"); + + ctx->request_finished = TRUE; + /* Incoming stream has ended */ + g_signal_emit_by_name (ctx->appsrc, "end-of-stream", &ret); + if (!ret) + g_printerr ("Unable to emit end-of-stream after an aborted stream\n"); +} + +static void handle_request_cb (SoupServer *server, SoupMessage *msg, const char *path, @@ -404,6 +421,10 @@ PUT: { g_signal_connect (msg, "got-chunk", G_CALLBACK (got_request_body_chunk), ctx); + /* This will also be called when the client sending + * the PUT request disconnects prematurely */ + g_signal_connect (msg, "finished", + G_CALLBACK (stream_finished_cb), ctx); goto out; } |