summaryrefslogtreecommitdiff
path: root/src/lib.c
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2014-07-14 15:46:39 (GMT)
committerNirbheek Chauhan <nirbheek@centricular.com>2014-07-14 15:46:40 (GMT)
commitdf0f28945f2c32f519457e838eb424401eb586e9 (patch)
tree0069fb922da82ac01f0fa3a0eea572da7f863d35 /src/lib.c
parentfeee319e6b6cb4774cce72d90d1a60f5ecc9bbda (diff)
downloadsoup-transcoding-proxy-df0f28945f2c32f519457e838eb424401eb586e9.zip
soup-transcoding-proxy-df0f28945f2c32f519457e838eb424401eb586e9.tar.gz
server: Always send data from the last keyframe
Store non-keyframe buffers sent to fakesink, and push them to all new clients
Diffstat (limited to 'src/lib.c')
-rw-r--r--src/lib.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib.c b/src/lib.c
index b22e82f..f527e04 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -59,6 +59,15 @@ stp_on_gst_bus_message (GstBus *bus,
return TRUE;
}
+gboolean stp_unref_gst_buffer (GstBuffer **buffer,
+ guint idx,
+ gpointer user_data)
+{
+ gst_buffer_unref (*buffer);
+ *buffer = NULL;
+ return TRUE;
+}
+
/* When the incoming stream reaches EOS, we call this
* which initiates a shutdown for all clients and then
* the server itself */
@@ -75,6 +84,9 @@ stp_cleanup_transcode_server_ctx (TranscodeServerCtx *ctx)
gst_element_set_state (ctx->pipeline, GST_STATE_NULL);
gst_object_unref (ctx->pipeline);
+ gst_buffer_list_foreach (ctx->keyframe, stp_unref_gst_buffer, NULL);
+ gst_buffer_list_unref (ctx->keyframe);
+
g_free (ctx);
}
@@ -100,7 +112,6 @@ pad_blocked_cleanup_cb (GstPad *srcpad,
gst_bin_remove (GST_BIN (ctx->server_ctx->pipeline), sinkbin);
gst_object_unref (sinkbin);
- g_mutex_clear (&ctx->can_write_chunk);
stp_print_status (" Client cleanup done!\n");
return GST_PAD_PROBE_OK;
}
@@ -128,6 +139,8 @@ stp_cleanup_transcode_client_ctx (TranscodeClientCtx *ctx)
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BLOCK,
(GstPadProbeCallback) pad_blocked_cleanup_cb,
ctx, (GDestroyNotify)g_free);
+
+ g_mutex_clear (&ctx->can_write_chunk);
gst_object_unref (sinkbin);
stp_print_status (".");
}