2017-09-01 15:29:28 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef CALL_RTP_CONFIG_H_
|
|
|
|
|
#define CALL_RTP_CONFIG_H_
|
2017-09-01 15:29:28 +02:00
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2017-09-01 15:29:28 +02:00
|
|
|
#include <string>
|
2018-07-17 16:03:46 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
[Stats] Explicit RTP-RTX and RTP-FEC mappings. Unblocks simulcast stats.
--- Background ---
The webrtc::VideoSendStream::StreamStats are converted into
VideoSenderInfo objects which turn into "outbound-rtp" stats objects in
getStats() (or "ssrc" objects in legacy getStats()).
StreamStats are created for each type of substream: RTP media streams,
RTX streams and FlexFEC streams - each with individual packet counters.
The RTX stream is responsible for retransmissions of a referenced media
stream and the FlexFEC stream is responsible for FEC of a referenced
media stream. RTX/FEC streams do not show up as separate objects in
getStats(). Only the media streams become "outbound-rtp" objects, but
their packet and byte counters have to include the RTX and FEC counters.
--- Overview of this CL ---
This CL adds MergeInfoAboutOutboundRtpSubstreams(). It takes
StreamStats of all kinds as input, and outputs media-only StreamStats
- incorporating the RTX and FEC counters into the relevant media
StreamStats.
The merged StreamStats objects is a smaller set of objects than the
non-merged counterparts, but when aggregating all packet counters
together we end up with exact same packet and count as before.
Because WebRtcVideoSendStream::GetVideoSenderInfo() currently aggregates
the StreamStats into a single VideoSenderInfo (single "outbound-rtp"),
this CL should not have any observable side-effects. Prior to this CL:
aggregate StreamStats. After this CL: merge StreamStats and then
aggregate them.
However, when simulcast stats are implemented (WIP CL:
https://webrtc-review.googlesource.com/c/src/+/168120) each RTP media
stream should turn into an individual "outbound-rtp" object. We will
then no longer aggregate all StreamStats into a single "info". This CL
unblocks simulcast stats by providing StreamStats objects that could be
turned into individual VideoSenderInfos.
--- The Changes ---
1. Methods added to RtpConfig to be able to easily tell the relationship
between RTP, RTX and FEC ssrcs.
2. StreamStats gets a StreamType (kMedia, kRtx or kFlexfec) that
replaces the booleans (is_rtx, is_flexfec).
3. "referenced_media_ssrc" is added to StreamStats, making it possible
to tell which kRtx/kFlexFec stream stats need to be merged with which
kMedia StreamStats.
4. MergeInfoAboutOutboundRtpSubstreams() added and used.
Bug: webrtc:11439
Change-Id: Iaf9002041169a054ddfd32c7ea06bd1dc36c6bca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170826
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30869}
2020-03-24 13:30:50 +01:00
|
|
|
#include "absl/types/optional.h"
|
2018-07-17 16:03:46 +02:00
|
|
|
#include "api/rtp_headers.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/rtp_parameters.h"
|
2017-09-01 15:29:28 +02:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2018-07-17 16:03:46 +02:00
|
|
|
// Currently only VP8/VP9 specific.
|
|
|
|
|
struct RtpPayloadState {
|
|
|
|
|
int16_t picture_id = -1;
|
|
|
|
|
uint8_t tl0_pic_idx = 0;
|
2018-08-08 16:33:01 +02:00
|
|
|
int64_t shared_frame_id = 0;
|
2018-07-17 16:03:46 +02:00
|
|
|
};
|
2019-05-24 13:40:02 +02:00
|
|
|
|
|
|
|
|
// Settings for LNTF (LossNotification). Still highly experimental.
|
|
|
|
|
struct LntfConfig {
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
|
2019-05-24 13:50:56 +02:00
|
|
|
bool enabled{false};
|
2019-05-24 13:40:02 +02:00
|
|
|
};
|
|
|
|
|
|
2017-09-01 15:29:28 +02:00
|
|
|
// Settings for NACK, see RFC 4585 for details.
|
|
|
|
|
struct NackConfig {
|
|
|
|
|
NackConfig() : rtp_history_ms(0) {}
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
// Send side: the time RTP packets are stored for retransmissions.
|
|
|
|
|
// Receive side: the time the receiver is prepared to wait for
|
|
|
|
|
// retransmissions.
|
|
|
|
|
// Set to '0' to disable.
|
|
|
|
|
int rtp_history_ms;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Settings for ULPFEC forward error correction.
|
|
|
|
|
// Set the payload types to '-1' to disable.
|
|
|
|
|
struct UlpfecConfig {
|
|
|
|
|
UlpfecConfig()
|
|
|
|
|
: ulpfec_payload_type(-1),
|
|
|
|
|
red_payload_type(-1),
|
|
|
|
|
red_rtx_payload_type(-1) {}
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
bool operator==(const UlpfecConfig& other) const;
|
|
|
|
|
|
|
|
|
|
// Payload type used for ULPFEC packets.
|
|
|
|
|
int ulpfec_payload_type;
|
|
|
|
|
|
|
|
|
|
// Payload type used for RED packets.
|
|
|
|
|
int red_payload_type;
|
|
|
|
|
|
|
|
|
|
// RTX payload type for RED payload.
|
|
|
|
|
int red_rtx_payload_type;
|
|
|
|
|
};
|
2018-07-17 16:03:46 +02:00
|
|
|
|
|
|
|
|
static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4.
|
|
|
|
|
struct RtpConfig {
|
|
|
|
|
RtpConfig();
|
|
|
|
|
RtpConfig(const RtpConfig&);
|
|
|
|
|
~RtpConfig();
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
|
|
|
|
|
std::vector<uint32_t> ssrcs;
|
|
|
|
|
|
2018-12-21 09:23:38 -08:00
|
|
|
// The Rtp Stream Ids (aka RIDs) to send in the RID RTP header extension
|
|
|
|
|
// if the extension is included in the list of extensions.
|
|
|
|
|
// If rids are specified, they should correspond to the |ssrcs| vector.
|
|
|
|
|
// This means that:
|
|
|
|
|
// 1. rids.size() == 0 || rids.size() == ssrcs.size().
|
|
|
|
|
// 2. If rids is not empty, then |rids[i]| should use |ssrcs[i]|.
|
|
|
|
|
std::vector<std::string> rids;
|
|
|
|
|
|
2018-07-17 16:03:46 +02:00
|
|
|
// The value to send in the MID RTP header extension if the extension is
|
|
|
|
|
// included in the list of extensions.
|
|
|
|
|
std::string mid;
|
|
|
|
|
|
|
|
|
|
// See RtcpMode for description.
|
|
|
|
|
RtcpMode rtcp_mode = RtcpMode::kCompound;
|
|
|
|
|
|
|
|
|
|
// Max RTP packet size delivered to send transport from VideoEngine.
|
|
|
|
|
size_t max_packet_size = kDefaultMaxPacketSize;
|
|
|
|
|
|
2018-10-29 11:22:05 +01:00
|
|
|
// Corresponds to the SDP attribute extmap-allow-mixed.
|
|
|
|
|
bool extmap_allow_mixed = false;
|
|
|
|
|
|
2018-07-17 16:03:46 +02:00
|
|
|
// RTP header extensions to use for this send stream.
|
|
|
|
|
std::vector<RtpExtension> extensions;
|
|
|
|
|
|
|
|
|
|
// TODO(nisse): For now, these are fixed, but we'd like to support
|
|
|
|
|
// changing codec without recreating the VideoSendStream. Then these
|
|
|
|
|
// fields must be removed, and association between payload type and codec
|
|
|
|
|
// must move above the per-stream level. Ownership could be with
|
|
|
|
|
// RtpTransportControllerSend, with a reference from PayloadRouter, where
|
|
|
|
|
// the latter would be responsible for mapping the codec type of encoded
|
|
|
|
|
// images to the right payload type.
|
|
|
|
|
std::string payload_name;
|
|
|
|
|
int payload_type = -1;
|
2019-05-23 13:21:12 +02:00
|
|
|
// Payload should be packetized using raw packetizer (payload header will
|
|
|
|
|
// not be added, additional meta data is expected to be present in generic
|
|
|
|
|
// frame descriptor RTP header extension).
|
|
|
|
|
bool raw_payload = false;
|
2018-07-17 16:03:46 +02:00
|
|
|
|
2019-05-24 13:40:02 +02:00
|
|
|
// See LntfConfig for description.
|
|
|
|
|
LntfConfig lntf;
|
|
|
|
|
|
2018-07-17 16:03:46 +02:00
|
|
|
// See NackConfig for description.
|
|
|
|
|
NackConfig nack;
|
|
|
|
|
|
|
|
|
|
// See UlpfecConfig for description.
|
|
|
|
|
UlpfecConfig ulpfec;
|
|
|
|
|
|
|
|
|
|
struct Flexfec {
|
|
|
|
|
Flexfec();
|
|
|
|
|
Flexfec(const Flexfec&);
|
|
|
|
|
~Flexfec();
|
|
|
|
|
// Payload type of FlexFEC. Set to -1 to disable sending FlexFEC.
|
|
|
|
|
int payload_type = -1;
|
|
|
|
|
|
|
|
|
|
// SSRC of FlexFEC stream.
|
|
|
|
|
uint32_t ssrc = 0;
|
|
|
|
|
|
|
|
|
|
// Vector containing a single element, corresponding to the SSRC of the
|
|
|
|
|
// media stream being protected by this FlexFEC stream.
|
|
|
|
|
// The vector MUST have size 1.
|
|
|
|
|
//
|
|
|
|
|
// TODO(brandtr): Update comment above when we support
|
|
|
|
|
// multistream protection.
|
|
|
|
|
std::vector<uint32_t> protected_media_ssrcs;
|
|
|
|
|
} flexfec;
|
|
|
|
|
|
|
|
|
|
// Settings for RTP retransmission payload format, see RFC 4588 for
|
|
|
|
|
// details.
|
|
|
|
|
struct Rtx {
|
|
|
|
|
Rtx();
|
|
|
|
|
Rtx(const Rtx&);
|
|
|
|
|
~Rtx();
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
// SSRCs to use for the RTX streams.
|
|
|
|
|
std::vector<uint32_t> ssrcs;
|
|
|
|
|
|
|
|
|
|
// Payload type to use for the RTX stream.
|
|
|
|
|
int payload_type = -1;
|
|
|
|
|
} rtx;
|
|
|
|
|
|
|
|
|
|
// RTCP CNAME, see RFC 3550.
|
|
|
|
|
std::string c_name;
|
[Stats] Explicit RTP-RTX and RTP-FEC mappings. Unblocks simulcast stats.
--- Background ---
The webrtc::VideoSendStream::StreamStats are converted into
VideoSenderInfo objects which turn into "outbound-rtp" stats objects in
getStats() (or "ssrc" objects in legacy getStats()).
StreamStats are created for each type of substream: RTP media streams,
RTX streams and FlexFEC streams - each with individual packet counters.
The RTX stream is responsible for retransmissions of a referenced media
stream and the FlexFEC stream is responsible for FEC of a referenced
media stream. RTX/FEC streams do not show up as separate objects in
getStats(). Only the media streams become "outbound-rtp" objects, but
their packet and byte counters have to include the RTX and FEC counters.
--- Overview of this CL ---
This CL adds MergeInfoAboutOutboundRtpSubstreams(). It takes
StreamStats of all kinds as input, and outputs media-only StreamStats
- incorporating the RTX and FEC counters into the relevant media
StreamStats.
The merged StreamStats objects is a smaller set of objects than the
non-merged counterparts, but when aggregating all packet counters
together we end up with exact same packet and count as before.
Because WebRtcVideoSendStream::GetVideoSenderInfo() currently aggregates
the StreamStats into a single VideoSenderInfo (single "outbound-rtp"),
this CL should not have any observable side-effects. Prior to this CL:
aggregate StreamStats. After this CL: merge StreamStats and then
aggregate them.
However, when simulcast stats are implemented (WIP CL:
https://webrtc-review.googlesource.com/c/src/+/168120) each RTP media
stream should turn into an individual "outbound-rtp" object. We will
then no longer aggregate all StreamStats into a single "info". This CL
unblocks simulcast stats by providing StreamStats objects that could be
turned into individual VideoSenderInfos.
--- The Changes ---
1. Methods added to RtpConfig to be able to easily tell the relationship
between RTP, RTX and FEC ssrcs.
2. StreamStats gets a StreamType (kMedia, kRtx or kFlexfec) that
replaces the booleans (is_rtx, is_flexfec).
3. "referenced_media_ssrc" is added to StreamStats, making it possible
to tell which kRtx/kFlexFec stream stats need to be merged with which
kMedia StreamStats.
4. MergeInfoAboutOutboundRtpSubstreams() added and used.
Bug: webrtc:11439
Change-Id: Iaf9002041169a054ddfd32c7ea06bd1dc36c6bca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170826
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30869}
2020-03-24 13:30:50 +01:00
|
|
|
|
|
|
|
|
bool IsMediaSsrc(uint32_t ssrc) const;
|
|
|
|
|
bool IsRtxSsrc(uint32_t ssrc) const;
|
|
|
|
|
bool IsFlexfecSsrc(uint32_t ssrc) const;
|
|
|
|
|
absl::optional<uint32_t> GetRtxSsrcAssociatedWithMediaSsrc(
|
|
|
|
|
uint32_t media_ssrc) const;
|
|
|
|
|
uint32_t GetMediaSsrcAssociatedWithRtxSsrc(uint32_t rtx_ssrc) const;
|
|
|
|
|
uint32_t GetMediaSsrcAssociatedWithFlexfecSsrc(uint32_t flexfec_ssrc) const;
|
Reland "Improve outbound-rtp statistics for simulcast"
This reverts commit 9a925c9ce33a6ccdd11b545b11ba68e985c2a65d.
Reason for revert: The original CL is updated in PS #2 to
fix the googRtt issue which was that when the legacy sender
stats were put in "aggregated_senders" we forgot to update
rtt_ms the same way that we do it for "senders".
Original change's description:
> Revert "Improve outbound-rtp statistics for simulcast"
>
> This reverts commit da6cda839dac7d9d18eba8d365188fa94831e0b1.
>
> Reason for revert: Breaks googRtt in legacy getStats API
>
> Original change's description:
> > Improve outbound-rtp statistics for simulcast
> >
> > Bug: webrtc:9547
> > Change-Id: Iec4eb976aa11ee743805425bedb77dcea7c2c9be
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168120
> > Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Reviewed-by: Henrik Boström <hbos@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Eldar Rello <elrello@microsoft.com>
> > Cr-Commit-Position: refs/heads/master@{#31097}
>
> TBR=hbos@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,srte@webrtc.org,hta@webrtc.org,elrello@microsoft.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: webrtc:9547
> Change-Id: I06673328c2a5293a7eef03b3aaf2ded9d13df1b3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174443
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31165}
TBR=hbos@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,srte@webrtc.org,hta@webrtc.org,elrello@microsoft.com
# Not skipping CQ checks because this is a reland.
Bug: webrtc:9547
Change-Id: I723744c496c3c65f95ab6a8940862c8b9f544338
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174480
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31169}
2020-05-05 15:54:46 +02:00
|
|
|
absl::optional<std::string> GetRidForSsrc(uint32_t ssrc) const;
|
2018-07-17 16:03:46 +02:00
|
|
|
};
|
2017-09-01 15:29:28 +02:00
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // CALL_RTP_CONFIG_H_
|