Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
iparticipant.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023 Roc Streaming authors
3
*
4
* This Stream Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_rtcp/iparticipant.h
10
//! @brief RTCP participant.
11
12
#ifndef ROC_RTCP_IPARTICIPANT_H_
13
#define ROC_RTCP_IPARTICIPANT_H_
14
15
#include "
roc_core/attributes.h
"
16
#include "
roc_packet/units.h
"
17
#include "
roc_rtcp/participant_info.h
"
18
#include "
roc_rtcp/reports.h
"
19
#include "
roc_status/status_code.h
"
20
21
namespace
roc
{
22
namespace
rtcp
{
23
24
//! RTCP participant.
25
//!
26
//! Implemented by sender and receiver pipelines (see roc_pipeline module).
27
//!
28
//! Used by rtcp::Communicator to generate reports for local sending and/or receiving
29
//! streams, and to process reports from remote streams.
30
//!
31
//! One RTCP participant is usually associated with zero or one local sending stream and
32
//! one or a few (in case of multicast) remote sending streams.
33
//!
34
//! For the local sending stream, multiple remote receivers may exists. Communicator
35
//! will query one sending report from IParticipant for the sending stream, and
36
//! notify IParticipant with multiple receiving reports, one for every discovered
37
//! remote receiver.
38
//!
39
//! For each local receiving stream, there is corresponding remote sender.
40
//! Communicator will query receiving report from IParticipant for every local
41
//! receiving stream, as will notify IParticipant with corresponding sender
42
//! report for every local receiving stream.
43
//!
44
//! Single IParticipant instance usually corresponds to a single RTP session. However,
45
//! this is not a strict requirement: if configuration requires multiple related RTP
46
//! sessions to transfer single logical source, e.g. one RTP session for media packets
47
//! and another RTP session for FEC packets, then both RTP sessions will be associated
48
//! with a single IParticipant instance.
49
class
IParticipant
{
50
public
:
51
virtual
~IParticipant
();
52
53
//! Get local participant info.
54
//! Invoked to know local CNAME, SSRC, etc.
55
virtual
ParticipantInfo
participant_info
() = 0;
56
57
//! Change local SSRC to another randomly selected number.
58
//! Invoked when SSRC collision is detected.
59
virtual
void
change_source_id
() = 0;
60
61
//! Check whether pipeline has local sending stream.
62
//! There can be only one local sending stream (or none).
63
virtual
bool
has_send_stream
() {
64
return
false
;
65
}
66
67
//! Query sending report for local sending stream.
68
//! Report will be used to generate RTCP packets for remote receivers.
69
virtual
SendReport
query_send_stream
(
core::nanoseconds_t
report_time) {
70
return
SendReport
();
71
}
72
73
//! Notify local sending stream with receiver report.
74
//! Report was gathered from RTCP packets from remote receiver.
75
//! @p recv_source_id identifies remote receiver which sent report.
76
//! In case of multicast sessions, one sending stream may have
77
//! multiple receivers.
78
virtual
ROC_ATTR_NODISCARD
status::StatusCode
79
notify_send_stream
(
packet::stream_source_t
recv_source_id,
80
const
RecvReport
& recv_report) {
81
return
status::StatusOK
;
82
}
83
84
//! Check how many local receiving streams are present.
85
//! Multiple local receiving streams are allowed, each one corresponding to
86
//! its own remote sender with unique sender SSRC.
87
virtual
size_t
num_recv_streams
() {
88
return
0;
89
}
90
91
//! Query receiving reports from local receiving streams.
92
//! Reports will be used to generate RTCP packets for remote senders.
93
//! @p reports points to a buffer of @p n_reports size,
94
//! where @p n_reports <= num_recv_streams().
95
virtual
void
query_recv_streams
(
RecvReport
* reports,
96
size_t
n_reports,
97
core::nanoseconds_t
report_time) {
98
}
99
100
//! Notify local receiving stream with sender report.
101
//! Report was gathered from RTCP packets from remote sender.
102
//! @p send_source_id identifies remote sender which sent report.
103
//! If there are multiple receiving streams, each one will be notified
104
//! with corresponding report.
105
virtual
ROC_ATTR_NODISCARD
status::StatusCode
106
notify_recv_stream
(
packet::stream_source_t
send_source_id,
107
const
SendReport
& send_report) {
108
return
status::StatusOK
;
109
}
110
111
//! Terminate local receiving stream.
112
//! Invoked when BYE packet is received from remote sender.
113
//! @p send_source_id identifies remote sender which sent BYE.
114
virtual
void
halt_recv_stream
(
packet::stream_source_t
send_source_id) {
115
}
116
};
117
118
}
// namespace rtcp
119
}
// namespace roc
120
121
#endif
// ROC_RTCP_IPARTICIPANT_H_
attributes.h
Compiler attributes.
ROC_ATTR_NODISCARD
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition
attributes.h:31
roc::rtcp::IParticipant
RTCP participant.
Definition
iparticipant.h:49
roc::rtcp::IParticipant::query_recv_streams
virtual void query_recv_streams(RecvReport *reports, size_t n_reports, core::nanoseconds_t report_time)
Query receiving reports from local receiving streams. Reports will be used to generate RTCP packets f...
Definition
iparticipant.h:95
roc::rtcp::IParticipant::notify_recv_stream
virtual ROC_ATTR_NODISCARD status::StatusCode notify_recv_stream(packet::stream_source_t send_source_id, const SendReport &send_report)
Notify local receiving stream with sender report. Report was gathered from RTCP packets from remote s...
Definition
iparticipant.h:106
roc::rtcp::IParticipant::participant_info
virtual ParticipantInfo participant_info()=0
Get local participant info. Invoked to know local CNAME, SSRC, etc.
roc::rtcp::IParticipant::num_recv_streams
virtual size_t num_recv_streams()
Check how many local receiving streams are present. Multiple local receiving streams are allowed,...
Definition
iparticipant.h:87
roc::rtcp::IParticipant::change_source_id
virtual void change_source_id()=0
Change local SSRC to another randomly selected number. Invoked when SSRC collision is detected.
roc::rtcp::IParticipant::query_send_stream
virtual SendReport query_send_stream(core::nanoseconds_t report_time)
Query sending report for local sending stream. Report will be used to generate RTCP packets for remot...
Definition
iparticipant.h:69
roc::rtcp::IParticipant::notify_send_stream
virtual ROC_ATTR_NODISCARD status::StatusCode notify_send_stream(packet::stream_source_t recv_source_id, const RecvReport &recv_report)
Notify local sending stream with receiver report. Report was gathered from RTCP packets from remote r...
Definition
iparticipant.h:79
roc::rtcp::IParticipant::halt_recv_stream
virtual void halt_recv_stream(packet::stream_source_t send_source_id)
Terminate local receiving stream. Invoked when BYE packet is received from remote sender....
Definition
iparticipant.h:114
roc::rtcp::IParticipant::has_send_stream
virtual bool has_send_stream()
Check whether pipeline has local sending stream. There can be only one local sending stream (or none)...
Definition
iparticipant.h:63
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc::packet::stream_source_t
uint32_t stream_source_t
Packet stream identifier.
Definition
units.h:27
roc::rtcp
RTCP protocol support.
roc
Root namespace.
participant_info.h
Participant info.
reports.h
RTCP reports.
status_code.h
Status codes.
roc::status::StatusCode
StatusCode
Status code.
Definition
status_code.h:19
roc::status::StatusOK
@ StatusOK
Status indicating a success of an operation.
Definition
status_code.h:20
roc::rtcp::ParticipantInfo
Participant info.
Definition
participant_info.h:39
roc::rtcp::RecvReport
Receiver report, for inspection on sender.
Definition
reports.h:94
roc::rtcp::SendReport
Sender report, for inspection on receiver.
Definition
reports.h:27
units.h
Various units used in packets.
roc_rtcp
iparticipant.h
Generated by
1.17.0