aboutsummaryrefslogtreecommitdiff
path: root/plugins/rtp/src/stream.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2021-12-18 21:43:12 +0100
committerMarvin W <git@larma.de>2021-12-18 21:43:12 +0100
commit4f80a9f5ccea5eaf6a78a841af417c597eb7db73 (patch)
treefe57f53210e0bdd2b36dffcebbf516eca74c7911 /plugins/rtp/src/stream.vala
parent09cd060889c27f51d43e1e2dc127c2a13595234d (diff)
downloaddino-4f80a9f5ccea5eaf6a78a841af417c597eb7db73.tar.gz
dino-4f80a9f5ccea5eaf6a78a841af417c597eb7db73.zip
RTP: Correctly handle timestamp after re-enabling a stream
Diffstat (limited to 'plugins/rtp/src/stream.vala')
-rw-r--r--plugins/rtp/src/stream.vala11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/rtp/src/stream.vala b/plugins/rtp/src/stream.vala
index 85864022..2cc40783 100644
--- a/plugins/rtp/src/stream.vala
+++ b/plugins/rtp/src/stream.vala
@@ -29,7 +29,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
public Device input_device { get { return _input_device; } set {
if (!paused) {
var input = this.input;
- set_input(value != null ? value.link_source(payload_type, our_ssrc, next_seqnum_offset) : null);
+ set_input(value != null ? value.link_source(payload_type, our_ssrc, next_seqnum_offset, next_timestamp_offset) : null);
if (this._input_device != null) this._input_device.unlink(input);
}
this._input_device = value;
@@ -46,6 +46,13 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
private bool push_recv_data = false;
private uint our_ssrc = Random.next_int();
private int next_seqnum_offset = -1;
+ private uint32 next_timestamp_offset_base = 0;
+ private int64 next_timestamp_offset_stamp = 0;
+ private uint32 next_timestamp_offset { get {
+ if (next_timestamp_offset_base == 0) return 0;
+ int64 monotonic_diff = get_monotonic_time() - next_timestamp_offset_stamp;
+ return next_timestamp_offset_base + (uint32)((double)monotonic_diff / 1000000.0 * payload_type.clockrate);
+ } }
private uint32 participant_ssrc = 0;
private Gst.Pad recv_rtcp_sink_pad;
@@ -657,7 +664,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream {
public void unpause() {
if (!paused) return;
- set_input_and_pause(input_device != null ? input_device.link_source(payload_type, our_ssrc, next_seqnum_offset) : null, false);
+ set_input_and_pause(input_device != null ? input_device.link_source(payload_type, our_ssrc, next_seqnum_offset, next_timestamp_offset) : null, false);
}
public uint get_participant_ssrc(Xmpp.Jid participant) {