Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
receiver.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 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_peer/receiver.h
10//! @brief Receiver peer.
11
12#ifndef ROC_PEER_RECEIVER_H_
13#define ROC_PEER_RECEIVER_H_
14
18#include "roc_core/mutex.h"
20#include "roc_peer/basic_peer.h"
21#include "roc_peer/context.h"
24#include "roc_rtp/format_map.h"
25
26namespace roc {
27namespace peer {
28
29//! Receiver peer.
31public:
32 //! Initialize.
34
35 //! Deinitialize.
37
38 //! Check if successfully constructed.
39 bool valid();
40
41 //! Set multicast interface address for given endpoint type.
42 bool set_multicast_group(size_t slot_index, address::Interface iface, const char* ip);
43
44 //! Bind peer to local endpoint.
45 bool bind(size_t slot_index, address::Interface iface, address::EndpointUri& uri);
46
47 //! Get receiver source.
49
50private:
51 struct Port {
54
55 Port()
56 : handle(NULL) {
57 }
58 };
59
60 struct Slot {
62 Port ports[address::Iface_Max];
63
64 Slot()
65 : slot(NULL) {
66 }
67 };
68
69 bool check_compatibility_(address::Interface iface, const address::EndpointUri& uri);
70 void update_compatibility_(address::Interface iface, const address::EndpointUri& uri);
71
72 Slot* get_slot_(size_t slot_index);
73
74 virtual void schedule_task_processing(pipeline::PipelineLoop&,
76 virtual void cancel_task_processing(pipeline::PipelineLoop&);
77
78 core::Mutex mutex_;
79
80 rtp::FormatMap format_map_;
81
82 pipeline::ReceiverLoop pipeline_;
83 ctl::ControlLoop::Tasks::PipelineProcessing processing_task_;
84
85 core::Array<Slot, 8> slots_;
86
87 bool used_interfaces_[address::Iface_Max];
89
90 bool valid_;
91};
92
93} // namespace peer
94} // namespace roc
95
96#endif // ROC_PEER_RECEIVER_H_
Base class for peers.
Network endpoint URI.
struct PortHandle * PortHandle
Opaque port handle.
Base class for peers.
Definition basic_peer.h:22
Context & context()
Peer's context.
Peer context.
Definition context.h:45
Receiver peer.
Definition receiver.h:30
~Receiver()
Deinitialize.
Receiver(Context &context, const pipeline::ReceiverConfig &pipeline_config)
Initialize.
bool bind(size_t slot_index, address::Interface iface, address::EndpointUri &uri)
Bind peer to local endpoint.
sndio::ISource & source()
Get receiver source.
bool valid()
Check if successfully constructed.
bool set_multicast_group(size_t slot_index, address::Interface iface, const char *ip)
Set multicast interface address for given endpoint type.
Pipeline task scheduler interface. PipelineLoop uses this interface to schedule asynchronous work....
struct SlotHandle * SlotHandle
Opaque slot handle.
Source interface.
Definition isource.h:23
Peer context.
Control loop thread.
Network endpoint URI.
RTP payload format map.
Interface ID.
Pipeline task scheduler interface.
Mutex.
Interface
Interface ID.
Definition interface.h:19
@ Iface_Max
Number of interfaces.
Definition interface.h:36
Protocol
Protocol ID.
Definition protocol.h:19
int64_t nanoseconds_t
Nanoseconds.
Definition time.h:58
Root namespace.
Protocol ID.
Receiver pipeline loop.
UDP receiver parameters.
Receiver parameters.
Definition config.h:247