summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-03-14 19:17:03 +0200
committerArun Raghavan <arun@arunraghavan.net>2017-05-02 08:15:37 +0530
commitba739824f6befed071213603e4e273b2a3f55380 (patch)
tree95eb1f5ecdbb084d53a70824eca6f0b074b920c0
parenta7b520ec5f7800e59bc08a4a31d9c0a8f469adac (diff)
rtp: Properly timestamp buffers in the GStreamer sender pipelinegst-rtp
Otherwise default timestamping will happen, which might not be correct, especially not after the stream was suspended for a while.
-rw-r--r--src/modules/rtp/rtp-gstreamer.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/modules/rtp/rtp-gstreamer.c b/src/modules/rtp/rtp-gstreamer.c
index fa6636386..52ebd41dd 100644
--- a/src/modules/rtp/rtp-gstreamer.c
+++ b/src/modules/rtp/rtp-gstreamer.c
@@ -233,6 +233,19 @@ int pa_rtp_send(pa_rtp_context *c, pa_memblockq *q) {
return -1;
while (!stop && pa_memblockq_peek(q, &chunk) == 0) {
+ GstClock *clock;
+ GstClockTime timestamp, clock_time;
+
+ clock = gst_element_get_clock(c->pipeline);
+ clock_time = gst_clock_get_time(clock);
+ gst_object_unref(clock);
+
+ timestamp = gst_element_get_base_time(c->pipeline);
+ if (timestamp > clock_time)
+ timestamp -= clock_time;
+ else
+ timestamp = 0;
+
pa_assert(chunk.memblock);
data = pa_memblock_acquire(chunk.memblock);
@@ -241,6 +254,8 @@ int pa_rtp_send(pa_rtp_context *c, pa_memblockq *q) {
data, chunk.length, chunk.index, chunk.length, chunk.memblock,
(GDestroyNotify) free_buffer);
+ GST_BUFFER_PTS(buf) = timestamp;
+
if (gst_app_src_push_buffer(GST_APP_SRC(c->appsrc), buf) != GST_FLOW_OK) {
pa_log_error("Could not push buffer");
stop = true;