Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
receiver_endpoint.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Roc Streaming authors
3 *
4 * This Source 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_pipeline/receiver_endpoint.h
10//! @brief Receiver endpoint pipeline.
11
12#ifndef ROC_PIPELINE_RECEIVER_ENDPOINT_H_
13#define ROC_PIPELINE_RECEIVER_ENDPOINT_H_
14
17#include "roc_core/iarena.h"
18#include "roc_core/mpsc_queue.h"
19#include "roc_core/optional.h"
21#include "roc_core/scoped_ptr.h"
22#include "roc_packet/iparser.h"
23#include "roc_packet/iwriter.h"
24#include "roc_pipeline/config.h"
27#include "roc_rtcp/parser.h"
28#include "roc_rtp/format_map.h"
29#include "roc_rtp/parser.h"
30
31namespace roc {
32namespace pipeline {
33
34//! Receiver endpoint sub-pipeline.
35//!
36//! Contains:
37//! - a pipeline for processing packets from single network endpoint
38//! - a reference to session group to which packets are routed
39class ReceiverEndpoint : public core::RefCounted<ReceiverEndpoint, core::ArenaAllocation>,
40 public core::ListNode,
41 private packet::IWriter {
42public:
43 //! Initialize.
44 //! - @p writer to handle packets received on netio thread.
46 ReceiverState& receiver_state,
47 ReceiverSessionGroup& session_group,
48 const rtp::FormatMap& format_map,
50
51 //! Check if the port pipeline was succefully constructed.
52 bool is_valid() const;
53
54 //! Get protocol.
56
57 //! Get endpoint writer.
58 //! @remarks
59 //! Packets passed to this writer will be pulled by endpoint pipeline.
60 //! This writer is thread-safe and lock-free.
61 //! The writer is passed to netio thread.
63
64 //! Pull packets writter to endpoint writer.
66
67private:
68 virtual ROC_ATTR_NODISCARD status::StatusCode write(const packet::PacketPtr& packet);
69
70 const address::Protocol proto_;
71
72 ReceiverState& receiver_state_;
73 ReceiverSessionGroup& session_group_;
74
75 packet::IParser* parser_;
76
80
82};
83
84} // namespace pipeline
85} // namespace roc
86
87#endif // ROC_PIPELINE_RECEIVER_ENDPOINT_H_
#define ROC_ATTR_NODISCARD
Emit warning if function result is not checked.
Definition attributes.h:31
IArena & arena() const
Get arena.
Memory arena interface.
Definition iarena.h:23
Base class for list element.
Definition list_node.h:26
Base class for object with reference counter.
Definition ref_counted.h:40
Packet parser interface.
Definition iparser.h:22
Packet writer interface.
Definition iwriter.h:23
Receiver endpoint sub-pipeline.
ReceiverEndpoint(address::Protocol proto, ReceiverState &receiver_state, ReceiverSessionGroup &session_group, const rtp::FormatMap &format_map, core::IArena &arena)
Initialize.
ROC_ATTR_NODISCARD status::StatusCode pull_packets()
Pull packets writter to endpoint writer.
packet::IWriter & writer()
Get endpoint writer.
address::Protocol proto() const
Get protocol.
bool is_valid() const
Check if the port pipeline was succefully constructed.
Receiver pipeline state. Thread-safe.
RTP payload format map. Thread-safe. Returned formats are immutable and can be safely used from any t...
Definition format_map.h:33
RTP payload format map.
Memory arena interface.
Interface ID.
Packet parser interface.
Packet writer interface.
Multi-producer single-consumer queue.
Protocol
Protocol ID.
Definition protocol.h:19
Root namespace.
Optionally constructed object.
Protocol ID.
Receiver session group.
Receiver pipeline state.
Base class for object with reference counter.
Pipeline config.
RTCP packet parser.
RTP packet parser.
Unique ownrship pointer.
StatusCode
Status code.
Definition status_code.h:19