uvgRTP 4.0.0
An open-source library for RTP/SRTP media delivery
Loading...
Searching...
No Matches
media_stream.hh
1#pragma once
2
3#include "util.hh"
4
5#include "uvgrtp/export.hh"
6#include "uvgrtp/definitions.hh"
7
8#include <unordered_map>
9#include <memory>
10#include <string>
11#include <atomic>
12#include <cstdint>
13
14#ifndef _WIN32
15#include <sys/socket.h>
16#include <netinet/in.h>
17#else
18#include <ws2ipdef.h>
19#endif
20namespace uvgrtp {
21
22 // forward declarations
24 class rtcp;
25 class socketfactory;
26
27 namespace frame {
28 struct rtp_frame;
29 }
30
31 namespace formats {
32 class media;
33 }
34
35 class media_stream_internal;
37
49 class UVGRTP_EXPORT media_stream {
51 friend class session;
53 public:
58
75 rtp_error_t start_zrtp();
76
94 rtp_error_t add_srtp_ctx(uint8_t* key, uint8_t* salt);
95
119 rtp_error_t push_frame(uint8_t* data, size_t data_len, int rtp_flags);
120
151 rtp_error_t push_frame(uint8_t* data, size_t data_len, uint32_t ts, int rtp_flags);
152
186 rtp_error_t push_frame(uint8_t* data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags);
187
198
211
232 rtp_error_t install_receive_hook(void* arg, void (*hook)(void*, uvgrtp::frame::rtp_frame*));
233
244 rtp_error_t configure_ctx(int rcc_flag, ssize_t value);
245
255 int get_configuration_value(int rcc_flag);
256
270
278 uint32_t get_ssrc() const;
279
285 rtp_error_t stop();
286
287
288#if UVGRTP_EXTENDED_API
289
316 rtp_error_t push_frame(std::unique_ptr<uint8_t[]> data, size_t data_len, int rtp_flags);
317
347 rtp_error_t push_frame(std::unique_ptr<uint8_t[]> data, size_t data_len, uint32_t ts, int rtp_flags);
348
349
382 rtp_error_t push_frame(std::unique_ptr<uint8_t[]> data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags);
383
384 // End of EXTENDED_API group
385#endif
386
387 private:
388
389 media_stream(std::string cname, std::string remote_addr, std::string local_addr, uint16_t src_port, uint16_t dst_port,
390 rtp_format_t fmt, std::shared_ptr<uvgrtp::socketfactory> sfp, int rce_flags, uint32_t ssrc = 0);
391
392 media_stream_internal* impl_;
393 };
394}
395
396namespace uvg_rtp = uvgrtp;
The media_stream is an entity which represents one RTP stream.
rtp_error_t stop()
Stop the media stream and its background components (RTCP, reception flow, holepuncher)
RTCP instance handles all incoming and outgoing RTCP traffic, including report generation.
Definition rtcp.hh:53
Provides ZRTP synchronization and can be used to create uvgrtp::media_stream objects.
Definition session.hh:30
rtp_error_t add_srtp_ctx(uint8_t *key, uint8_t *salt)
Add keying information for user-managed SRTP session.
rtp_error_t push_frame(uint8_t *data, size_t data_len, int rtp_flags)
Send data to remote participant with a custom timestamp.
rtp_error_t configure_ctx(int rcc_flag, ssize_t value)
Configure the media stream, see RTP_CTX_CONFIGURATION_FLAGS for more details.
uvgrtp::frame::rtp_frame * pull_frame(size_t timeout_ms)
Poll a frame for a specified time from the media stream object.
rtp_error_t push_frame(uint8_t *data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags)
Send data to remote participant with custom RTP and NTP timestamps.
rtp_error_t install_receive_hook(void *arg, void(*hook)(void *, uvgrtp::frame::rtp_frame *))
Asynchronous way of getting frames.
uint32_t get_ssrc() const
Get SSRC identifier. You can use the SSRC value for example to find the report block belonging to thi...
rtp_error_t start_zrtp()
Start the ZRTP negotiation manually.
uvgrtp::frame::rtp_frame * pull_frame()
Poll a frame indefinitely from the media stream object.
uvgrtp::rtcp * get_rtcp()
Get pointer to the RTCP object of the media stream.
rtp_error_t push_frame(uint8_t *data, size_t data_len, uint32_t ts, int rtp_flags)
Send data to remote participant with a custom timestamp.
int get_configuration_value(int rcc_flag)
Get the values associated with configuration flags, see RTP_CTX_CONFIGURATION_FLAGS for more details.
rtp_error_t push_frame(std::unique_ptr< uint8_t[]> data, size_t data_len, int rtp_flags)
Send data to remote participant with a custom timestamp.
rtp_error_t push_frame(std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags)
Send data to remote participant with custom RTP and NTP timestamps.
rtp_error_t push_frame(std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, int rtp_flags)
Send data to remote participant with a custom timestamp.
See RFC 3550 section 5
Definition frame.hh:94