uvgRTP 3.1.3
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 class socketfactory;
16
27 class session {
28 public:
30 session(std::string cname, std::string addr, std::shared_ptr<uvgrtp::socketfactory> sfp);
31 session(std::string cname, std::string remote_addr, std::string local_addr, std::shared_ptr<uvgrtp::socketfactory> sfp);
32 ~session();
34
63 uvgrtp::media_stream *create_stream(uint16_t src_port, uint16_t dst_port, rtp_format_t fmt, int rce_flags);
64
88 uvgrtp::media_stream *create_stream(uint16_t port, rtp_format_t fmt, int rce_flags);
89
102
104 /* Get unique key of the session
105 * Used by context to index sessions */
106 std::string& get_key();
108
109 private:
110 /* Each RTP multimedia session shall have one ZRTP session from which all session are derived */
111 std::shared_ptr<uvgrtp::zrtp> zrtp_;
112
113 std::string generic_address_;
114
115 /* Each RTP multimedia session is always IP-specific */
116 std::string remote_address_;
117
118 /* If user so wishes, the session can be bound to a certain interface */
119 std::string local_address_;
120
121 /* All media streams of this session */
122 std::unordered_map<uint32_t, uvgrtp::media_stream *> streams_;
123
124 std::mutex session_mtx_;
125
126 std::string cname_;
127 std::shared_ptr<uvgrtp::socketfactory> sf_;
128 };
129}
130
131namespace uvg_rtp = uvgrtp;
The media_stream is an entity which represents one RTP stream.
Provides ZRTP synchronization and can be used to create uvgrtp::media_stream objects.
Definition session.hh:27
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.