mirror of
https://gerrit.osmocom.org/osmo-gbproxy
synced 2024-08-21 18:36:25 +00:00
mgcp/rtp: Compute delta timestamp based on wallclock
Currently, when the SSRC changes within a stream and SSRC fixing is enabled, the RTP timestamp between the last packet that has been received with the old SSRC and the first packet of the new SSRC is always incremented by one packet duration. This can lead to audio muting (at least with the nanoBTS) when the wallclock interval between these packets is too large (> 1s). This patch changes the implementation to base the RTP timestamp offset on the wallclock interval that has passed between these two packets. Ticket: OW#466 Sponsored-by: On-Waves ehf
This commit is contained in:
parent
5708800d4f
commit
e0f41eabdc
3 changed files with 19 additions and 10 deletions
|
@ -46,6 +46,7 @@ struct mgcp_rtp_stream_state {
|
|||
uint32_t last_timestamp;
|
||||
uint32_t err_ts_counter;
|
||||
int32_t last_tsdelta;
|
||||
uint32_t last_arrival_time;
|
||||
};
|
||||
|
||||
struct mgcp_rtp_state {
|
||||
|
|
|
@ -415,10 +415,17 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
|
|||
|
||||
state->in_stream.ssrc = ssrc;
|
||||
if (rtp_end->force_constant_ssrc) {
|
||||
const int16_t delta_seq = 1;
|
||||
int16_t delta_seq;
|
||||
|
||||
/* Always increment seqno by 1 */
|
||||
state->seq_offset =
|
||||
(state->out_stream.last_seq + delta_seq) - seq;
|
||||
(state->out_stream.last_seq + 1) - seq;
|
||||
|
||||
/* Estimate number of packets that would have been sent */
|
||||
delta_seq =
|
||||
(arrival_time - state->in_stream.last_arrival_time
|
||||
+ state->packet_duration/2) /
|
||||
state->packet_duration;
|
||||
|
||||
adjust_rtp_timestamp_offset(endp, state, rtp_end, addr,
|
||||
delta_seq, timestamp);
|
||||
|
@ -452,6 +459,7 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
|
|||
/* Save before patching */
|
||||
state->in_stream.last_timestamp = timestamp;
|
||||
state->in_stream.last_seq = seq;
|
||||
state->in_stream.last_arrival_time = arrival_time;
|
||||
|
||||
if (rtp_end->force_aligned_timing &&
|
||||
state->out_stream.ssrc == ssrc && state->packet_duration)
|
||||
|
|
|
@ -167,14 +167,14 @@ In TS: 36888, dTS: 160, Seq: 25
|
|||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 27, Transit = 4294967216
|
||||
In TS: 160000, dTS: 0, Seq: 1000
|
||||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 765, Transit = 11760
|
||||
Out TS change: 12000, dTS: 12000, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 25, Transit = 4294967216
|
||||
In TS: 160160, dTS: 160, Seq: 1001
|
||||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 718, Transit = 11759
|
||||
Stats: Jitter = 24, Transit = 4294967215
|
||||
In TS: 160320, dTS: 160, Seq: 1002
|
||||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 673, Transit = 11759
|
||||
Stats: Jitter = 22, Transit = 4294967215
|
||||
Testing packet error detection.
|
||||
Output SSRC changed to 11223344
|
||||
In TS: 0, dTS: 0, Seq: 0
|
||||
|
@ -447,12 +447,12 @@ In TS: 36888, dTS: 160, Seq: 25
|
|||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 25, Transit = 4294967136
|
||||
In TS: 160000, dTS: 0, Seq: 1000
|
||||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 763, Transit = 11680
|
||||
Out TS change: 12000, dTS: 12000, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 23, Transit = 4294967136
|
||||
In TS: 160160, dTS: 160, Seq: 1001
|
||||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 716, Transit = 11679
|
||||
Stats: Jitter = 22, Transit = 4294967135
|
||||
In TS: 160320, dTS: 160, Seq: 1002
|
||||
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
|
||||
Stats: Jitter = 671, Transit = 11679
|
||||
Stats: Jitter = 21, Transit = 4294967135
|
||||
Done
|
||||
|
|
Loading…
Reference in a new issue