diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-09 14:29:55 (GMT) |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-09 14:29:55 (GMT) |
commit | 6a59214ddcdd63f7576e379834237d1ec0b92430 (patch) | |
tree | f3888e043b56ad361a0fb37f472b5e61bbe0dd1b | |
parent | 5ed7da826915cae8a1fc12301a6a3868f8367844 (diff) | |
download | soup-transcoding-proxy-6a59214ddcdd63f7576e379834237d1ec0b92430.zip soup-transcoding-proxy-6a59214ddcdd63f7576e379834237d1ec0b92430.tar.gz |
appsrc: Queue an EOS when aborted too
-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; } |