uvgRTP 2.3.0
An open-source library for RTP/SRTP media delivery
Loading...
Searching...
No Matches
session.hh
1#pragma once
2
3#include "util.hh"
4
5#include <mutex>
6#include <string>
7#include <vector>
8#include <unordered_map>
9#include <memory>
10
11namespace uvgrtp {
12
13 class media_stream;
14 class zrtp;
15
26 class session {
27 public:
29 session(std::string cname, std::string addr);
30 session(std::string cname, std::string remote_addr, std::string local_addr);
31 ~session();
33
62 uvgrtp::media_stream *create_stream(uint16_t src_port, uint16_t dst_port, rtp_format_t fmt, int rce_flags);
63
87 uvgrtp::media_stream *create_stream(uint16_t port, rtp_format_t fmt, int rce_flags);
88
101
103 /* Get unique key of the session
104 * Used by context to index sessions */
105 std::string& get_key();
107
108 private:
109 /* Each RTP multimedia session shall have one ZRTP session from which all session are derived */
110 std::shared_ptr<uvgrtp::zrtp> zrtp_;
111
112 std::string generic_address_;
113
114 /* Each RTP multimedia session is always IP-specific */
115 std::string remote_address_;
116
117 /* If user so wishes, the session can be bound to a certain interface */
118 std::string local_address_;
119
120 /* All media streams of this session */
121 std::unordered_map<uint32_t, uvgrtp::media_stream *> streams_;
122
123 std::mutex session_mtx_;
124
125 std::string cname_;
126 };
127}
128
129namespace uvg_rtp = uvgrtp;
The media_stream is an entity which represents one RTP stream.
Definition: media_stream.hh:50
Provides ZRTP synchronization and can be used to create uvgrtp::media_stream objects.
Definition: session.hh:26
uvgrtp::media_stream * create_stream(uint16_t port, rtp_format_t fmt, int rce_flags)
Create a unidirectional media_stream for an RTP session.
uvgrtp::media_stream * create_stream(uint16_t src_port, uint16_t dst_port, rtp_format_t fmt, int rce_flags)
Create a uni- or bidirectional media stream.
rtp_error_t destroy_stream(uvgrtp::media_stream *stream)
Destroy a media stream.