monologue_publish() never copied the offered label into the media,
so sdp_create() omitted a=label from the publish answer and from
subscribe requests for that publisher. Add the missing
media_update_label() call.
Closes#2200
Change-Id: Id9aaf4ab09c21f98d3dcaf78632413b99f4a97ff
(cherry picked from commit b66c59bed6)
The kernel tracks lost packets per SSRC through the `lost_bits` window
in the shared ssrc_stats, which was left zeroed, while userspace starts
its own window as all-received. As userspace already advances `ext_seq`
before a stream is kernelised, the kernel then counted up to 32 packets
it did receive as lost, both per SSRC and in the interface and global
packets_lost counters. Start the shared window as all-received too.
Change-Id: I3d6cd85a1b764a6bb3296daf7489091767449554
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3b73432826)
ssrc_collect_metrics() converted the running RFC 3550 jitter estimate
to milliseconds in place on every call timer run with --measure-rtp,
dividing it by clock_rate/1000 each time. The estimator is kept in
RTP timestamp units and also feeds generated RTCP RRs, which therefore
reported a jitter decaying towards zero. Convert a copy instead.
The RTCP test expected the resulting zero jitter; it now gets the
value actually measured from its back-to-back packets.
Change-Id: Ice29029322764fd76374eb3f7dda517570f7f75b
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4dd1826ffa)
Copy create-answer and subscribe-answer SDP into call-owned storage before parsing, matching offer/answer and publish. Retained stream parameters otherwise reference released NG request buffers and later subscriptions can lose their media type and codecs.
Initialize created-answer monologue session state so generated subscriptions retain a valid SDP origin and session name. Add request-buffer-churn and decoded-audio regressions for created and subscribed endpoints.
Validation on standalone Sipwise master: daemon build, all 89 retained-SDP assertions, all 652 create assertions, and all 932 publish/subscribe assertions pass. The cumulative 26.2.1 release also has isolated browser Opus decoding, privacy, recording, and mixer regression coverage.
Closes#2194
Change-Id: Id8ca0e0ff691356d905ee94c0f41090f973fc70f
(cherry picked from commit 12ecdbc2cf)
Update media player, send timer, jitter buffer objects.
Set final memory arena pointer as the releasing the last reference might
reset it to null.
Exclude media_player stuff from no-transcoding builds and adjust ifdef
guards accordingly.
Closes#2186
Change-Id: I42dc5a449816d765bc4d1da2b35315e0b6f7c29b
(cherry picked from commit 2366392202)
Share SSRC dump and restore helpers between ingress and egress, keeping
ssrc_out_table as the outbound list name. Scope each hash lock to its
dump rather than holding both locks throughout media serialization.
Restore records without an outbound list through the original combined
in/out path, including records written before the SSRC hash split.
Adapt the takeover regression test from kbinetruy's PR #2188 to exercise
native and JSON records, sequence rollover, encryption after restart,
and both legacy record layouts. Follow the existing Redis helper,
initializer, iteration, and daemon-test patterns.
Ref #2185
Change-Id: I0ac7e6b351fd3e2bcab38d0318d1787e5332c442
Co-authored-by: Kevin Binetruy <kevin.binetruy@ovhcloud.com>
(cherry picked from commit afb98f00d3)
Since the SSRC contexts were split into separate ingress and egress
entries (cf22d829), only the ingress entries are written to the SSRC
table, and the lines for the outbound index are commented out. The
restore still looks for the out_* keys in the ingress entries, where
they no longer are.
A node that takes over a call therefore starts encrypting from index 0
again. A receiver estimates the ROC from its own state, so if the
sequence number of the call has already wrapped, it rejects every
packet after the takeover.
Write the egress entries to a list of their own, ssrc_out_table, and
restore them from there. Records without the list restore as before.
Fixes#2183Closes#2185
Change-Id: Id28dc86c658f7e94dd87443fc0f09225beaf484e
(cherry picked from commit ef16e3f1e7)
After a takeover, FOREIGN_MEDIA holds off the media timeout until the
call receives media. The flag is cleared by the first packet that
arrives on any of the call's sockets, before the packet is checked, so
a packet that is then dropped, for example because of strict-source,
ends the grace period without refreshing the stream's last packet time.
A call that was restored longer than the timeout ago is then closed on
the next timer run, before its real media has had a chance to arrive.
With the peer address confirmation now restored from Redis, this is
what happens to an adopted strict-source call when a stray packet
arrives ahead of the peer's first one.
Clear the flag only once a packet has passed the address check. The
timer still clears it for kernel-forwarded media, and the grace period
stays bounded by the timeout after the takeover.
Ref #2184
Change-Id: Ib06a170d271e8aea709abc57cbfd3bcc59196ab5
(cherry picked from commit 1d783ba1b9)
A call restored from Redis starts with every sfd unconfirmed and every
stream's el_flags at zero, which is EL_DELAYED, regardless of what the
offer asked for or what --endpoint-learning is set to. After a
keyspace-notification failover, all adopted calls therefore re-learn
their peer at the same time, and strict-source has nothing to compare
against until they have.
Write the sfd's confirmed flag and the stream's el_flags and
learned_endpoint to the record, and read them back on restore. The two
stream fields were so far only part of the rollback snapshot. Move them
into the shared stream encoder and decoder, so that both use the same
definition. Records without the new keys restore as before.
Fixes#2182Closes#2184
Change-Id: I6228e55796e7a680b05797df985573e8ab54c653
(cherry picked from commit bac92fbb5e)
Both mean that the ice towards the offerer gets rejected.
When a certain peer who previously offered ice, sends SDP without ice
(e.g. T.38 re-invite), or the ice was requested to be removed
(when processing answer) with `ICE=remove` then the ice agent is left alive
with its learned ufrag, candidates and succeeded pairs.
The stream endpoint is then taken from that SDP (non-ice path).
If this peer later offers ice again with the same credentials (e.g.
falling back to audio after an error response like 488 for that T.38),
then this stale agent is reused:
`__fill_stream()` ignores the new endpoint because the ice data
considered as unchanged, and then the `ice_update()` drops these candidates as duplicates.
Therefore no connectivity checks run and then the endpoint stays at the old non-iced address.
Media gets bound to the wrong port.
Shutdown the ice agent whenever the peer's own sdp no longer carries ice,
or we get the `ICE=remove`.
Then the offered ice again later starts from scratch.
Change-Id: I5ff3b6454262099022bf4f61c84b978835130dcc
(cherry picked from commit 39fd49b6c4)
Update the sockaddr_t to an endpoint_t and change the generic pointer to
a more type-safe argument
Closes#2176Closes#2178
Change-Id: Ib734079051a2a8916eeae9942df3ea53a1637985
The SSRC only appears in the response to the offer or answer that picked it.
The `egress SSRCs` list fills in after the first forwarded packet, so a query
at signalling time returns nothing.
Report the value as its own per-media key. It is set when the offer is
processed, so it can be read before media flows.
Closes#2171
Change-Id: I738d702ab13fd71b56269960bce16994ddb3c8a0
A controlling agent feeding media into a WebRTC SFU needs to know the SSRC
of the incoming stream before it can bind a receiver to it, and the SFU
needs that SSRC to stay put for the life of the call.
With `fixed egress SSRC` set, rtpengine picks an SSRC for each media at
signalling time and returns the chosen values in the offer or answer
response, one entry per m= section along with its index and media type.
The value is recorded as the ingress entry's `ssrc_map_out`, which is
already the mapping every consumer reads: the egress entry is keyed off it,
RTCP rewriting uses it, and the kernel module is handed it as `ssrc_out`.
Because one egress entry then stands in for every ingress SSRC, it outlives
a change of source, so `seq_diff` carries across on its own. All that is
left is re-basing it once at the changeover, taking the last sequence
number from the counter shared with the kernel module so that it is still
right while the stream is offloaded.
The substitution itself goes in the plain passthrough handler rather than
the SSRC passthrough one, so that it applies to builds without transcoding
support as well. Those builds compile the kernel side regardless, so
leaving the userspace half out would have meant the original SSRC being
forwarded until the stream was offloaded and the fixed one afterwards.
Change-Id: Iad5508c53d29d1e7d54c825da1ab56069cdd89b7