2017-08-22 05:43:23 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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_VIDEO_SEND_STREAM_H_
|
|
|
|
|
#define CALL_VIDEO_SEND_STREAM_H_
|
2017-08-22 05:43:23 -07:00
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include <stdint.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include "absl/types/optional.h"
|
2020-06-11 12:07:14 +02:00
|
|
|
#include "api/adaptation/resource.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/call/transport.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/crypto/crypto_options.h"
|
2020-02-27 16:16:55 +01:00
|
|
|
#include "api/frame_transformer_interface.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/rtp_parameters.h"
|
2020-06-11 12:07:14 +02:00
|
|
|
#include "api/scoped_refptr.h"
|
2018-10-23 12:03:01 +02:00
|
|
|
#include "api/video/video_content_type.h"
|
2018-10-10 10:58:52 +02:00
|
|
|
#include "api/video/video_frame.h"
|
2018-05-11 11:15:30 +02:00
|
|
|
#include "api/video/video_sink_interface.h"
|
2018-05-21 14:09:31 +02:00
|
|
|
#include "api/video/video_source_interface.h"
|
2018-07-24 09:29:58 +02:00
|
|
|
#include "api/video/video_stream_encoder_settings.h"
|
2018-05-18 11:37:23 +02:00
|
|
|
#include "api/video_codecs/video_encoder_config.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/rtp_config.h"
|
2020-08-25 10:28:50 +02:00
|
|
|
#include "common_video/frame_counts.h"
|
2019-05-28 17:42:38 +02:00
|
|
|
#include "common_video/include/quality_limitation_reason.h"
|
2019-05-27 10:44:24 +02:00
|
|
|
#include "modules/rtp_rtcp/include/report_block_data.h"
|
2018-11-27 14:05:08 +01:00
|
|
|
#include "modules/rtp_rtcp/include/rtcp_statistics.h"
|
2017-12-15 14:40:10 +01:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
2017-08-22 05:43:23 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-10-17 17:27:25 -07:00
|
|
|
class FrameEncryptorInterface;
|
|
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
class VideoSendStream {
|
|
|
|
|
public:
|
[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
|
|
|
// Multiple StreamStats objects are present if simulcast is used (multiple
|
|
|
|
|
// kMedia streams) or if RTX or FlexFEC is negotiated. Multiple SVC layers, on
|
|
|
|
|
// the other hand, does not cause additional StreamStats.
|
2017-08-22 05:43:23 -07:00
|
|
|
struct StreamStats {
|
[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
|
|
|
enum class StreamType {
|
|
|
|
|
// A media stream is an RTP stream for audio or video. Retransmissions and
|
|
|
|
|
// FEC is either sent over the same SSRC or negotiated to be sent over
|
|
|
|
|
// separate SSRCs, in which case separate StreamStats objects exist with
|
|
|
|
|
// references to this media stream's SSRC.
|
|
|
|
|
kMedia,
|
|
|
|
|
// RTX streams are streams dedicated to retransmissions. They have a
|
2021-07-26 12:40:21 +02:00
|
|
|
// dependency on a single kMedia stream: `referenced_media_ssrc`.
|
[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
|
|
|
kRtx,
|
|
|
|
|
// FlexFEC streams are streams dedicated to FlexFEC. They have a
|
2021-07-26 12:40:21 +02:00
|
|
|
// dependency on a single kMedia stream: `referenced_media_ssrc`.
|
[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
|
|
|
kFlexfec,
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
StreamStats();
|
|
|
|
|
~StreamStats();
|
|
|
|
|
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
|
[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
|
|
|
StreamType type = StreamType::kMedia;
|
2021-07-26 12:40:21 +02:00
|
|
|
// If `type` is kRtx or kFlexfec this value is present. The referenced SSRC
|
[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
|
|
|
// is the kMedia stream that this stream is performing retransmissions or
|
2021-07-26 12:40:21 +02:00
|
|
|
// FEC for. If `type` is kMedia, this value is null.
|
[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
|
|
|
absl::optional<uint32_t> referenced_media_ssrc;
|
2017-08-22 05:43:23 -07:00
|
|
|
FrameCounts frame_counts;
|
|
|
|
|
int width = 0;
|
|
|
|
|
int height = 0;
|
|
|
|
|
// TODO(holmer): Move bitrate_bps out to the webrtc::Call layer.
|
|
|
|
|
int total_bitrate_bps = 0;
|
|
|
|
|
int retransmit_bitrate_bps = 0;
|
|
|
|
|
int avg_delay_ms = 0;
|
|
|
|
|
int max_delay_ms = 0;
|
2019-05-16 18:38:20 +02:00
|
|
|
uint64_t total_packet_send_delay_ms = 0;
|
2017-08-22 05:43:23 -07:00
|
|
|
StreamDataCounters rtp_stats;
|
|
|
|
|
RtcpPacketTypeCounter rtcp_packet_type_counts;
|
2019-05-27 10:44:24 +02:00
|
|
|
// A snapshot of the most recent Report Block with additional data of
|
|
|
|
|
// interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
|
|
|
|
|
absl::optional<ReportBlockData> report_block_data;
|
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
|
|
|
double encode_frame_rate = 0.0;
|
|
|
|
|
int frames_encoded = 0;
|
|
|
|
|
absl::optional<uint64_t> qp_sum;
|
|
|
|
|
uint64_t total_encode_time_ms = 0;
|
|
|
|
|
uint64_t total_encoded_bytes_target = 0;
|
|
|
|
|
uint32_t huge_frames_sent = 0;
|
2017-08-22 05:43:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Stats {
|
|
|
|
|
Stats();
|
|
|
|
|
~Stats();
|
|
|
|
|
std::string ToString(int64_t time_ms) const;
|
|
|
|
|
std::string encoder_implementation_name = "unknown";
|
2021-11-10 11:23:56 +09:00
|
|
|
double input_frame_rate = 0;
|
2017-08-22 05:43:23 -07:00
|
|
|
int encode_frame_rate = 0;
|
|
|
|
|
int avg_encode_time_ms = 0;
|
|
|
|
|
int encode_usage_percent = 0;
|
|
|
|
|
uint32_t frames_encoded = 0;
|
2019-04-02 15:05:21 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-totalencodetime
|
|
|
|
|
uint64_t total_encode_time_ms = 0;
|
2019-05-20 15:15:38 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-totalencodedbytestarget
|
|
|
|
|
uint64_t total_encoded_bytes_target = 0;
|
2021-02-27 00:29:15 -08:00
|
|
|
uint32_t frames = 0;
|
2017-10-23 10:45:37 +02:00
|
|
|
uint32_t frames_dropped_by_capturer = 0;
|
|
|
|
|
uint32_t frames_dropped_by_encoder_queue = 0;
|
|
|
|
|
uint32_t frames_dropped_by_rate_limiter = 0;
|
2020-02-07 14:29:32 +01:00
|
|
|
uint32_t frames_dropped_by_congestion_window = 0;
|
2017-10-23 10:45:37 +02:00
|
|
|
uint32_t frames_dropped_by_encoder = 0;
|
2017-08-22 05:43:23 -07:00
|
|
|
// Bitrate the encoder is currently configured to use due to bandwidth
|
|
|
|
|
// limitations.
|
|
|
|
|
int target_media_bitrate_bps = 0;
|
|
|
|
|
// Bitrate the encoder is actually producing.
|
|
|
|
|
int media_bitrate_bps = 0;
|
|
|
|
|
bool suspended = false;
|
|
|
|
|
bool bw_limited_resolution = false;
|
|
|
|
|
bool cpu_limited_resolution = false;
|
|
|
|
|
bool bw_limited_framerate = false;
|
|
|
|
|
bool cpu_limited_framerate = false;
|
2019-05-28 17:42:38 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationreason
|
|
|
|
|
QualityLimitationReason quality_limitation_reason =
|
|
|
|
|
QualityLimitationReason::kNone;
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationdurations
|
|
|
|
|
std::map<QualityLimitationReason, int64_t> quality_limitation_durations_ms;
|
2019-09-09 11:26:45 +02:00
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
|
|
|
|
|
uint32_t quality_limitation_resolution_changes = 0;
|
2017-08-22 05:43:23 -07:00
|
|
|
// Total number of times resolution as been requested to be changed due to
|
|
|
|
|
// CPU/quality adaptation.
|
|
|
|
|
int number_of_cpu_adapt_changes = 0;
|
|
|
|
|
int number_of_quality_adapt_changes = 0;
|
2017-11-16 14:04:52 +01:00
|
|
|
bool has_entered_low_resolution = false;
|
2017-08-22 05:43:23 -07:00
|
|
|
std::map<uint32_t, StreamStats> substreams;
|
2017-09-06 12:32:35 -07:00
|
|
|
webrtc::VideoContentType content_type =
|
|
|
|
|
webrtc::VideoContentType::UNSPECIFIED;
|
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
|
|
|
uint32_t frames_sent = 0;
|
2018-02-28 16:35:03 +01:00
|
|
|
uint32_t huge_frames_sent = 0;
|
2017-08-22 05:43:23 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Config {
|
|
|
|
|
public:
|
|
|
|
|
Config() = delete;
|
|
|
|
|
Config(Config&&);
|
|
|
|
|
explicit Config(Transport* send_transport);
|
|
|
|
|
|
|
|
|
|
Config& operator=(Config&&);
|
|
|
|
|
Config& operator=(const Config&) = delete;
|
|
|
|
|
|
|
|
|
|
~Config();
|
|
|
|
|
|
|
|
|
|
// Mostly used by tests. Avoid creating copies if you can.
|
|
|
|
|
Config Copy() const { return Config(*this); }
|
|
|
|
|
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
|
2019-06-11 11:55:47 +00:00
|
|
|
RtpConfig rtp;
|
|
|
|
|
|
2019-06-11 14:57:57 +02:00
|
|
|
VideoStreamEncoderSettings encoder_settings;
|
|
|
|
|
|
2018-11-09 13:17:39 -08:00
|
|
|
// Time interval between RTCP report for video
|
|
|
|
|
int rtcp_report_interval_ms = 1000;
|
2018-01-31 22:08:26 -08:00
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
// Transport for outgoing packets.
|
|
|
|
|
Transport* send_transport = nullptr;
|
|
|
|
|
|
|
|
|
|
// Expected delay needed by the renderer, i.e. the frame will be delivered
|
|
|
|
|
// this many milliseconds, if possible, earlier than expected render time.
|
2021-07-26 12:40:21 +02:00
|
|
|
// Only valid if `local_renderer` is set.
|
2017-08-22 05:43:23 -07:00
|
|
|
int render_delay_ms = 0;
|
|
|
|
|
|
|
|
|
|
// Target delay in milliseconds. A positive value indicates this stream is
|
|
|
|
|
// used for streaming instead of a real-time call.
|
|
|
|
|
int target_delay_ms = 0;
|
|
|
|
|
|
|
|
|
|
// True if the stream should be suspended when the available bitrate fall
|
|
|
|
|
// below the minimum configured bitrate. If this variable is false, the
|
|
|
|
|
// stream may send at a rate higher than the estimated available bitrate.
|
|
|
|
|
bool suspend_below_min_bitrate = false;
|
|
|
|
|
|
|
|
|
|
// Enables periodic bandwidth probing in application-limited region.
|
|
|
|
|
bool periodic_alr_bandwidth_probing = false;
|
|
|
|
|
|
2018-10-17 17:27:25 -07:00
|
|
|
// An optional custom frame encryptor that allows the entire frame to be
|
|
|
|
|
// encrypted in whatever way the caller chooses. This is not required by
|
|
|
|
|
// default.
|
|
|
|
|
rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor;
|
|
|
|
|
|
|
|
|
|
// Per PeerConnection cryptography options.
|
|
|
|
|
CryptoOptions crypto_options;
|
|
|
|
|
|
2020-02-27 16:16:55 +01:00
|
|
|
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer;
|
|
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
private:
|
|
|
|
|
// Access to the copy constructor is private to force use of the Copy()
|
|
|
|
|
// method for those exceptional cases where we do use it.
|
|
|
|
|
Config(const Config&);
|
|
|
|
|
};
|
|
|
|
|
|
2018-02-02 08:46:16 -08:00
|
|
|
// Updates the sending state for all simulcast layers that the video send
|
|
|
|
|
// stream owns. This can mean updating the activity one or for multiple
|
|
|
|
|
// layers. The ordering of active layers is the order in which the
|
|
|
|
|
// rtp modules are stored in the VideoSendStream.
|
|
|
|
|
// Note: This starts stream activity if it is inactive and one of the layers
|
|
|
|
|
// is active. This stops stream activity if it is active and all layers are
|
|
|
|
|
// inactive.
|
2022-01-31 11:08:24 +01:00
|
|
|
virtual void UpdateActiveSimulcastLayers(std::vector<bool> active_layers) = 0;
|
2018-02-02 08:46:16 -08:00
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
// Starts stream activity.
|
|
|
|
|
// When a stream is active, it can receive, process and deliver packets.
|
|
|
|
|
virtual void Start() = 0;
|
|
|
|
|
// Stops stream activity.
|
|
|
|
|
// When a stream is stopped, it can't receive, process or deliver packets.
|
|
|
|
|
virtual void Stop() = 0;
|
|
|
|
|
|
2021-08-05 10:50:26 +02:00
|
|
|
// Accessor for determining if the stream is active. This is an inexpensive
|
|
|
|
|
// call that must be made on the same thread as `Start()` and `Stop()` methods
|
|
|
|
|
// are called on and will return `true` iff activity has been started either
|
|
|
|
|
// via `Start()` or `UpdateActiveSimulcastLayers()`. If activity is either
|
|
|
|
|
// stopped or is in the process of being stopped as a result of a call to
|
|
|
|
|
// either `Stop()` or `UpdateActiveSimulcastLayers()` where all layers were
|
|
|
|
|
// deactivated, the return value will be `false`.
|
|
|
|
|
virtual bool started() = 0;
|
|
|
|
|
|
2020-06-11 12:07:14 +02:00
|
|
|
// If the resource is overusing, the VideoSendStream will try to reduce
|
|
|
|
|
// resolution or frame rate until no resource is overusing.
|
|
|
|
|
// TODO(https://crbug.com/webrtc/11565): When the ResourceAdaptationProcessor
|
|
|
|
|
// is moved to Call this method could be deleted altogether in favor of
|
|
|
|
|
// Call-level APIs only.
|
|
|
|
|
virtual void AddAdaptationResource(rtc::scoped_refptr<Resource> resource) = 0;
|
|
|
|
|
virtual std::vector<rtc::scoped_refptr<Resource>>
|
|
|
|
|
GetAdaptationResources() = 0;
|
|
|
|
|
|
2017-08-22 05:43:23 -07:00
|
|
|
virtual void SetSource(
|
|
|
|
|
rtc::VideoSourceInterface<webrtc::VideoFrame>* source,
|
|
|
|
|
const DegradationPreference& degradation_preference) = 0;
|
|
|
|
|
|
|
|
|
|
// Set which streams to send. Must have at least as many SSRCs as configured
|
|
|
|
|
// in the config. Encoder settings are passed on to the encoder instance along
|
|
|
|
|
// with the VideoStream settings.
|
|
|
|
|
virtual void ReconfigureVideoEncoder(VideoEncoderConfig config) = 0;
|
|
|
|
|
|
|
|
|
|
virtual Stats GetStats() = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~VideoSendStream() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // CALL_VIDEO_SEND_STREAM_H_
|