mirror of
https://gerrit.osmocom.org/osmo-gbproxy
synced 2024-08-21 18:36:25 +00:00
mgcp/rtp: Make offset computation understandable
Rename the timestamp variable to make in clear, that the input timestamp is meant. Add a helper variable to illustrate the offset computation. Sponsored-by: On-Waves ehf
This commit is contained in:
parent
ecd157ac76
commit
9b7eb7b6af
1 changed files with 4 additions and 4 deletions
|
@ -241,10 +241,11 @@ static int adjust_rtp_timestamp_offset(struct mgcp_endpoint *endp,
|
|||
struct mgcp_rtp_state *state,
|
||||
struct mgcp_rtp_end *rtp_end,
|
||||
struct sockaddr_in *addr,
|
||||
int16_t delta_seq, uint32_t timestamp)
|
||||
int16_t delta_seq, uint32_t in_timestamp)
|
||||
{
|
||||
int32_t tsdelta = state->packet_duration;
|
||||
int timestamp_offset;
|
||||
uint32_t out_timestamp;
|
||||
|
||||
if (tsdelta == 0) {
|
||||
tsdelta = state->out_stream.last_tsdelta;
|
||||
|
@ -269,9 +270,8 @@ static int adjust_rtp_timestamp_offset(struct mgcp_endpoint *endp,
|
|||
}
|
||||
}
|
||||
|
||||
timestamp_offset =
|
||||
state->out_stream.last_timestamp - timestamp +
|
||||
delta_seq * tsdelta;
|
||||
out_timestamp = state->out_stream.last_timestamp + delta_seq * tsdelta;
|
||||
timestamp_offset = out_timestamp - in_timestamp;
|
||||
|
||||
if (state->timestamp_offset != timestamp_offset) {
|
||||
state->timestamp_offset = timestamp_offset;
|
||||
|
|
Loading…
Reference in a new issue