Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
sender_port.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Roc 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_port.h
10 //! @brief Sender port pipeline.
11 
12 #ifndef ROC_PIPELINE_SENDER_PORT_H_
13 #define ROC_PIPELINE_SENDER_PORT_H_
14 
15 #include "roc_core/iallocator.h"
16 #include "roc_core/noncopyable.h"
17 #include "roc_core/unique_ptr.h"
18 #include "roc_packet/icomposer.h"
19 #include "roc_packet/iwriter.h"
20 #include "roc_pipeline/config.h"
21 #include "roc_rtp/composer.h"
22 
23 namespace roc {
24 namespace pipeline {
25 
26 //! Sender port pipeline.
27 //! @remarks
28 //! Created at the sender side for every sending port.
29 class SenderPort : public packet::IWriter, public core::NonCopyable<> {
30 public:
31  //! Initialize.
32  SenderPort(const PortConfig& config,
33  packet::IWriter& writer,
34  core::IAllocator& allocator);
35 
36  //! Check if the port pipeline was succefully constructed.
37  bool valid() const;
38 
39  //! Get packet composer.
41 
42  //! Write packet.
43  void write(const packet::PacketPtr& packet);
44 
45 private:
46  const packet::Address dst_address_;
47 
48  packet::IWriter& writer_;
49  packet::IComposer* composer_;
50 
51  core::UniquePtr<rtp::Composer> rtp_composer_;
53 };
54 
55 } // namespace pipeline
56 } // namespace roc
57 
58 #endif // ROC_PIPELINE_SENDER_PORT_H_
Port parameters.
Definition: config.h:56
Memory allocator interface.
Definition: iallocator.h:23
Pipeline config.
SenderPort(const PortConfig &config, packet::IWriter &writer, core::IAllocator &allocator)
Initialize.
packet::IComposer & composer()
Get packet composer.
Root namespace.
void write(const packet::PacketPtr &packet)
Write packet.
Packet writer interface.
Network address.
Definition: address.h:24
Packet composer interface.
Definition: icomposer.h:22
Packet composer interface.
Packet writer interface.
Definition: iwriter.h:21
RTP packet composer.
Base class for non-copyable objects.
Definition: noncopyable.h:23
bool valid() const
Check if the port pipeline was succefully constructed.
Unique ownrship pointer.
Non-copyable object.
Sender port pipeline.
Definition: sender_port.h:29
Memory allocator interface.