summaryrefslogtreecommitdiff
path: root/gst/netsim
diff options
context:
space:
mode:
authorJun Xie <jun.xie@samsung.com>2017-12-21 18:33:49 +0800
committerTim-Philipp Müller <tim@centricular.com>2018-01-24 00:22:06 +0000
commit3f87a9dd7f629f02ad6c76ee7bdd213ac5409322 (patch)
tree06073872c4ebdd6bd3afa05a5dae29f5b0fd5d7b /gst/netsim
parent99f646b0096469929fde6b4200d79841988a8732 (diff)
downloadgstreamer-plugins-bad-3f87a9dd7f629f02ad6c76ee7bdd213ac5409322.tar.gz
netsim: fix misleading packet delay log
packet delay time shall be calculated by ready_time minus current time https://bugzilla.gnome.org/show_bug.cgi?id=791838
Diffstat (limited to 'gst/netsim')
-rw-r--r--gst/netsim/gstnetsim.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gst/netsim/gstnetsim.c b/gst/netsim/gstnetsim.c
index 51bbdb32e..66656a774 100644
--- a/gst/netsim/gstnetsim.c
+++ b/gst/netsim/gstnetsim.c
@@ -337,7 +337,7 @@ gst_net_sim_delay_buffer (GstNetSim * netsim, GstBuffer * buf)
gint delay;
PushBufferCtx *ctx;
GSource *source;
- gint64 ready_time;
+ gint64 ready_time, now_time;
switch (netsim->delay_distribution) {
case DISTRIBUTION_UNIFORM:
@@ -363,13 +363,14 @@ gst_net_sim_delay_buffer (GstNetSim * netsim, GstBuffer * buf)
ctx = push_buffer_ctx_new (netsim->srcpad, buf);
source = g_source_new (&gst_net_sim_source_funcs, sizeof (GSource));
- ready_time = g_get_monotonic_time () + delay * 1000;
+ now_time = g_get_monotonic_time ();
+ ready_time = now_time + delay * 1000;
if (!netsim->allow_reordering && ready_time < netsim->last_ready_time)
ready_time = netsim->last_ready_time + 1;
- GST_DEBUG_OBJECT (netsim, "Delaying packet by %ldms",
- (ready_time - netsim->last_ready_time) / 1000);
netsim->last_ready_time = ready_time;
+ GST_DEBUG_OBJECT (netsim, "Delaying packet by %ldms",
+ (ready_time - now_time) / 1000);
g_source_set_ready_time (source, ready_time);
g_source_set_callback (source, (GSourceFunc) push_buffer_ctx_push,