diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-11-23 11:11:55 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-12-04 12:15:37 +0100 |
commit | a9cde8bf1420bbb01f568e4e56647d1b16e7d496 (patch) | |
tree | dba985a8f385b618ddc85e2fccc34d1011edd60d | |
parent | cd7e49ac9c02c63b43a2891f4f0178b9e4ed6694 (diff) | |
download | cmumble-a9cde8bf1420bbb01f568e4e56647d1b16e7d496.tar.gz cmumble-a9cde8bf1420bbb01f568e4e56647d1b16e7d496.tar.bz2 cmumble-a9cde8bf1420bbb01f568e4e56647d1b16e7d496.zip |
Timestamp playback buffers with appropriate flags
* GST_BUFFER_FLAG_DISCONT helps to play immediately after a pause
(i.e. no talking)
TODO: Not sure GST_BUFFER_FLAG_RESYNC does really help, but
from the decoumentation it does what we want.
-rw-r--r-- | src/audio.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/audio.c b/src/audio.c index b1d46b3..e40b1c2 100644 --- a/src/audio.c +++ b/src/audio.c @@ -40,6 +40,7 @@ cmumble_audio_push(struct cmumble *cm, struct cmumble_user *user, */ gstbuf = gst_buffer_new_wrapped(g_memdup(data, size), size); + GST_BUFFER_FLAG_SET(gstbuf, GST_BUFFER_FLAG_LIVE); /* Asume packets are in order, since we're using tcp tunnel only atm. * FIXME: This assumption is probably wrong, since the packets may have @@ -47,19 +48,18 @@ cmumble_audio_push(struct cmumble *cm, struct cmumble_user *user, if (user->last_sequence < 0 || sequence == 0 || sequence < (user->last_sequence + 1)) { + GST_BUFFER_FLAG_SET(gstbuf, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_FLAG_SET(gstbuf, GST_BUFFER_FLAG_RESYNC); time = now - base; if (cm->verbose) g_print("%s: set time to now\n", __func__); -#if 0 - /* FIXME: is this a good idea, in case the pipeline paused - * because we pushed no more buffers? */ - gst_element_set_state(user->pipeline, GST_STATE_PLAYING); -#endif } else if (sequence >= user->last_sequence + 1) { gint64 num = sequence - (user->last_sequence + 1); - time = user->last_time_end + - gst_util_uint64_scale_int(num, GST_SECOND, 100); + time = user->last_time_end; + if (num > 0) { + time += gst_util_uint64_scale_int(num, GST_SECOND, 100); + GST_BUFFER_FLAG_SET(gstbuf, GST_BUFFER_FLAG_DISCONT); + } if (cm->verbose) g_print("%s: set time by sequence: %lu, now: %lu\n", __func__, time, now - base); @@ -67,6 +67,7 @@ cmumble_audio_push(struct cmumble *cm, struct cmumble_user *user, } if (time < (now - base)) { + GST_BUFFER_FLAG_SET(gstbuf, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_FLAG_SET(gstbuf, GST_BUFFER_FLAG_RESYNC); time = now - base; if (cm->verbose) |