I just want to clarify things regarding inbound, outbound, remote inbound, and remote outbound statistics in RTP. Suppose I have a server and client. On the server side, I have a setup where I am running webRTC and also measuring stats there, so now I am talking from server-side perspective. T
It does not matter if it is a server or client, the nomenclature should remain the same.
inbound is the local measurement of an incoming stream. outbound is the local measurement of an outgoing stream
remote inbound is the remote measurement of the outgoing stream, i.e., in RTP parlance, this is the data that sender receives in an RTCP RR from the receiver to the sender
remote outbound is the remote measurement of an incoming stream, i.e., in RTP parlance, this is the data the sender sends in an RTCP SR from the sender to the receiver.
In you example, Stream A is sent from the client to the server. Stream B is sent from the server to the client.
The server's getStats will report,
local inbound will report stats for Stream A, the stats are updated for each RTP packet received on Stream A, the timestamp in the getStats object is likely the reception timestamp for an RTP packet.
remote outbound will report stats for Stream A, this is based on the data/metrics reported by the sender in the RTCP SR packet, the timestamp in the getStats object is likely the reception timestamp of the RTCP SR packet.
local outbound will report stats for Stream B, since these packets are sent by the server, the stats are reported each time a packet on Stream B is sent. The timestamp of the getStats is the last RTP timestamp.
remote inbound will report stats for Stream B, this is based on the metrics reported in the RTCP RR. The timestamp in the getStats object is likely the reception timestamp of the RTCP RR packet.
To measure latency, see the roundtriptime reported in the remote-inbound. Since there are no send and receive timestamps, you cannot subtract timstamps, as the events are uncorrelated outbound and remote-inbound events are not correlated.
Further, clocks between endpoints are not synchronised, it is not possible to subtract timestamps remote and local timestamps.
Hope the answer helps.