aboutsummaryrefslogtreecommitdiff
path: root/plugins/rtp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/rtp')
-rw-r--r--plugins/rtp/src/device.vala6
-rw-r--r--plugins/rtp/src/stream.vala11
2 files changed, 14 insertions, 3 deletions
diff --git a/plugins/rtp/src/device.vala b/plugins/rtp/src/device.vala
index 89d499ed..de46bea4 100644
--- a/plugins/rtp/src/device.vala
+++ b/plugins/rtp/src/device.vala
@@ -96,7 +96,7 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
return element;
}
- public Gst.Element? link_source(PayloadType? payload_type = null, uint ssrc = Random.next_int(), int seqnum_offset = -1) {
+ public Gst.Element? link_source(PayloadType? payload_type = null, uint ssrc = Random.next_int(), int seqnum_offset = -1, uint32 timestamp_offset = 0) {
if (!is_source) return null;
if (element == null) create();
links++;
@@ -122,8 +122,12 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object {
var payload = (Gst.RTP.BasePayload) ((Gst.Bin) payloaders[payload_type][ssrc]).get_by_name(@"$(id)_$(codec)_$(ssrc)_rtp_pay");
payload.ssrc = ssrc;
payload.seqnum_offset = seqnum_offset;
+ if (timestamp_offset != 0) {
+ payload.timestamp_offset = timestamp_offset;
+ }
pipe.add(payloaders[payload_type][ssrc]);
codec_tees[payload_type].link(payloaders[payload_type][ssrc]);
+ debug("Payload for %s with %s using ssrc %u, seqnum_offset %u, timestamp_offset %u", media, codec, ssrc, seqnum_offset, timestamp_offset);
}
if (!payloader_tees.has_key(payload_type)) {
payloader_tees[payload_type] = new HashMap<uint, Gst.Element>();
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) {