Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
sender_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/sender_endpoint.h
10 //! @brief Sender endpoint pipeline.
11 
12 #ifndef ROC_PIPELINE_SENDER_ENDPOINT_H_
13 #define ROC_PIPELINE_SENDER_ENDPOINT_H_
14 
15 #include "roc_core/iarena.h"
16 #include "roc_core/noncopyable.h"
17 #include "roc_core/optional.h"
18 #include "roc_core/scoped_ptr.h"
19 #include "roc_packet/icomposer.h"
20 #include "roc_packet/iwriter.h"
21 #include "roc_packet/shipper.h"
22 #include "roc_pipeline/config.h"
23 #include "roc_rtcp/composer.h"
24 #include "roc_rtp/composer.h"
25 
26 namespace roc {
27 namespace pipeline {
28 
29 //! Sender endpoint sub-pipeline.
30 //!
31 //! Contains:
32 //! - a pipeline for processing packets for single network endpoint
34 public:
35  //! Initialize.
36  //! - @p dest_address specifies destination address that is assigned to the
37  //! outgoing packets in the end of endpoint pipeline
38  //! - @p dest_writer specifies destination writer to which packets are sent
39  //! in the end of endpoint pipeline
41  const address::SocketAddr& dest_address,
42  packet::IWriter& dest_writer,
43  core::IArena& arena);
44 
45  //! Check if pipeline was succefully constructed.
46  bool is_valid() const;
47 
48  //! Get protocol.
50 
51  //! Get packet composer.
52  //! @remarks
53  //! This composer will creates packets according to endpoint protocol.
55 
56  //! Get packet writer.
57  //! @remarks
58  //! This writer will pass packets to the endpoint pipeline.
60 
61 private:
62  const address::Protocol proto_;
63 
64  packet::IComposer* composer_;
65 
66  core::Optional<rtp::Composer> rtp_composer_;
68  core::Optional<rtcp::Composer> rtcp_composer_;
69  core::Optional<packet::Shipper> packet_shipper_;
70 };
71 
72 } // namespace pipeline
73 } // namespace roc
74 
75 #endif // ROC_PIPELINE_SENDER_ENDPOINT_H_
Socket address.
Definition: socket_addr.h:26
Memory arena interface.
Definition: iarena.h:23
Base class for non-copyable objects.
Definition: noncopyable.h:23
Optionally constructed object.
Definition: optional.h:25
Unique ownrship pointer.
Definition: scoped_ptr.h:33
Packet composer interface.
Definition: icomposer.h:22
Packet writer interface.
Definition: iwriter.h:23
Sender endpoint sub-pipeline.
address::Protocol proto() const
Get protocol.
packet::IWriter & writer()
Get packet writer.
SenderEndpoint(address::Protocol proto, const address::SocketAddr &dest_address, packet::IWriter &dest_writer, core::IArena &arena)
Initialize.
packet::IComposer & composer()
Get packet composer.
bool is_valid() const
Check if pipeline was succefully constructed.
Memory arena interface.
Packet composer interface.
Packet writer interface.
Protocol
Protocol ID.
Definition: protocol.h:19
Root namespace.
Non-copyable object.
Optionally constructed object.
Pipeline config.
RTCP packet composer.
RTP packet composer.
Unique ownrship pointer.
Prepare and ship outgoing packets.