Go to the documentation of this file.
50 #define MAX_SDP_SIZE 8192
58 #define DTLS_SRTP_KEY_LEN 16
59 #define DTLS_SRTP_SALT_LEN 14
67 #define DTLS_SRTP_CHECKSUM_LEN 16
78 #define ICE_DTLS_READ_INTERVAL 50
81 #define STUN_MAGIC_COOKIE 0x2112A442
88 #define DTLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC 20
96 #define DTLS_RECORD_LAYER_HEADER_LEN 13
102 #define DTLS_VERSION_10 0xfeff
103 #define DTLS_VERSION_12 0xfefd
112 #define MAX_UDP_BUFFER_SIZE 4096
115 #define WHIP_RTP_PAYLOAD_TYPE_H264 106
116 #define WHIP_RTP_PAYLOAD_TYPE_OPUS 111
124 #define ICE_STUN_HEADER_SIZE 20
131 #define WHIP_RTP_HEADER_SIZE 12
143 #define WHIP_RTCP_PT_START 192
144 #define WHIP_RTCP_PT_END 223
150 #define WHIP_SDP_SESSION_ID "4489045141692799359"
151 #define WHIP_SDP_CREATOR_IP "127.0.0.1"
154 #define ELAPSED(starttime, endtime) ((int)(endtime - starttime) / 1000)
399 int ret, ideal_pkt_size = 532;
415 if (whip->
pkt_size < ideal_pkt_size)
422 av_log(whip,
AV_LOG_VERBOSE,
"WHIP: Init state=%d, handshake_timeout=%dms, pkt_size=%d, seed=%d, elapsed=%dms\n",
455 av_log(whip,
AV_LOG_ERROR,
"WHIP: Unable to parse profile from empty extradata=%p, size=%d\n",
475 sps->profile_idc,
sps->level_idc);
512 for (
i = 0;
i <
s->nb_streams;
i++) {
562 av_log(whip,
AV_LOG_ERROR,
"WHIP: Unsupported audio channels %d by RTC, choose stereo\n",
573 av_log(whip,
AV_LOG_ERROR,
"WHIP: Codec type '%s' for stream %d is not supported by RTC\n",
593 const char *acodec_name =
NULL, *vcodec_name =
NULL;
620 "o=FFmpeg %s 2 IN IP4 %s\r\n"
621 "s=FFmpegPublishSession\r\n"
623 "a=group:BUNDLE 0 1\r\n"
624 "a=extmap-allow-mixed\r\n"
625 "a=msid-semantic: WMS\r\n",
631 acodec_name =
"opus";
634 "m=audio 9 UDP/TLS/RTP/SAVPF %u\r\n"
635 "c=IN IP4 0.0.0.0\r\n"
638 "a=fingerprint:sha-256 %s\r\n"
639 "a=setup:passive\r\n"
642 "a=msid:FFmpeg audio\r\n"
644 "a=rtpmap:%u %s/%d/%d\r\n"
645 "a=ssrc:%u cname:FFmpeg\r\n"
646 "a=ssrc:%u msid:FFmpeg audio\r\n",
663 vcodec_name =
"H264";
669 "m=video 9 UDP/TLS/RTP/SAVPF %u\r\n"
670 "c=IN IP4 0.0.0.0\r\n"
673 "a=fingerprint:sha-256 %s\r\n"
674 "a=setup:passive\r\n"
677 "a=msid:FFmpeg video\r\n"
680 "a=rtpmap:%u %s/90000\r\n"
681 "a=fmtp:%u level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=%02x%02x%02x\r\n"
682 "a=ssrc:%u cname:FFmpeg\r\n"
683 "a=ssrc:%u msid:FFmpeg video\r\n",
734 char *hex_data =
NULL;
745 ret =
snprintf(buf,
sizeof(buf),
"Cache-Control: no-cache\r\nContent-Type: application/sdp\r\n");
748 if (ret <= 0 || ret >=
sizeof(buf)) {
766 &
opts,
s->protocol_whitelist,
s->protocol_blacklist,
NULL);
788 av_log(whip,
AV_LOG_ERROR,
"WHIP: Failed to read response from url=%s, offer is %s, answer is %s\n",
872 char protocol[17], host[129];
874 ret = sscanf(ptr,
"%16s %d %128s %d typ host", protocol, &priority, host, &port);
883 av_log(whip,
AV_LOG_ERROR,
"WHIP: Protocol %s is not supported by RTC, choose udp, line %d %s of %s\n",
921 av_log(whip,
AV_LOG_VERBOSE,
"WHIP: SDP state=%d, offer=%luB, answer=%luB, ufrag=%s, pwd=%luB, transport=%s://%s:%d, elapsed=%dms\n",
971 if (ret <= 0 || ret >=
sizeof(username)) {
993 buf[2] = (
size - 20) >> 8;
994 buf[3] = (
size - 20) & 0xFF;
1004 buf[2] = (
size - 20) >> 8;
1005 buf[3] = (
size - 20) & 0xFF;
1011 *request_size =
size;
1040 if (tid_size != 12) {
1041 av_log(whip,
AV_LOG_ERROR,
"WHIP: Invalid transaction ID size. Expected 12, got %d\n", tid_size);
1066 buf[2] = (
size - 20) >> 8;
1067 buf[3] = (
size - 20) & 0xFF;
1077 buf[2] = (
size - 20) >> 8;
1078 buf[3] = (
size - 20) & 0xFF;
1084 *response_size =
size;
1144 av_log(whip,
AV_LOG_ERROR,
"WHIP: Invalid STUN message, expected at least %d, got %d\n",
1150 memcpy(tid, buf + 8, 12);
1189 &
opts,
s->protocol_whitelist,
s->protocol_blacklist,
NULL);
1217 char buf[256], *cert_buf =
NULL, *key_buf =
NULL;
1250 av_log(whip,
AV_LOG_ERROR,
"WHIP: DTLS handshake timeout=%dms, cost=%dms, elapsed=%dms, state=%d\n",
1278 av_log(whip,
AV_LOG_VERBOSE,
"WHIP: ICE STUN ok, state=%d, url=udp://%s:%d, location=%s, username=%s:%s, res=%dB, elapsed=%dms\n",
1300 &
opts,
s->protocol_whitelist,
s->protocol_blacklist,
NULL);
1352 const char*
suite =
"SRTP_AES128_CM_HMAC_SHA1_80";
1417 av_log(whip,
AV_LOG_VERBOSE,
"WHIP: SRTP setup done, state=%d, suite=%s, key=%luB, elapsed=%dms\n",
1433 int ret, cipher_size, is_rtcp, is_video;
1434 uint8_t payload_type;
1445 payload_type = buf[1] & 0x7f;
1455 if (cipher_size <= 0 || cipher_size < buf_size) {
1456 av_log(whip,
AV_LOG_WARNING,
"WHIP: Failed to encrypt packet=%dB, cipher=%dB\n", buf_size, cipher_size);
1482 int ret,
i, is_video, buffer_size, max_packet_size;
1501 for (
i = 0;
i <
s->nb_streams;
i++) {
1508 rtp_ctx->
oformat = rtp_format;
1565 s->streams[
i]->priv_data = rtp_ctx;
1571 av_log(whip,
AV_LOG_INFO,
"WHIP: Muxer state=%d, buffer_size=%d, max_packet_size=%d, "
1572 "elapsed=%dms(init:%d,offer:%d,answer:%d,udp:%d,ice:%d,dtls:%d,srtp:%d)\n",
1609 ret =
snprintf(buf,
sizeof(buf),
"Cache-Control: no-cache\r\n");
1612 if (ret <= 0 || ret >=
sizeof(buf)) {
1622 &
opts,
s->protocol_whitelist,
s->protocol_blacklist,
NULL);
1660 uint8_t unit_type, sps_seen = 0, pps_seen = 0, idr_seen = 0, *
out;
1661 const uint8_t *buf, *buf_end, *r1;
1673 if ((nal_size = r1 - buf) > 0) {
1674 unit_type = *buf & 0x1f;
1687 if (!idr_seen || (sps_seen && pps_seen))
1716 if ((nal_size = r1 - buf) > 0) {
1718 memcpy(
out + 3, buf, nal_size);
1719 out += 3 + nal_size;
1833 for (
i = 0;
i <
s->nb_streams;
i++) {
1847 s->streams[
i]->priv_data =
NULL;
1870 int ret = 1, extradata_isom = 0;
1878 av_log(whip,
AV_LOG_VERBOSE,
"WHIP: Enable BSF h264_mp4toannexb, packet=[%x %x %x %x %x ...], extradata_isom=%d\n",
1879 b[0],
b[1],
b[2],
b[3],
b[4], extradata_isom);
1887 #define OFFSET(x) offsetof(WHIPContext, x)
1888 #define ENC AV_OPT_FLAG_ENCODING_PARAM
1890 {
"handshake_timeout",
"Timeout in milliseconds for ICE and DTLS handshake.",
OFFSET(handshake_timeout),
AV_OPT_TYPE_INT, { .i64 = 5000 }, -1, INT_MAX,
ENC },
1891 {
"pkt_size",
"The maximum size, in bytes, of RTP packets that send out",
OFFSET(pkt_size),
AV_OPT_TYPE_INT, { .i64 = 1200 }, -1, INT_MAX,
ENC },
static void error(const char *err)
#define ICE_DTLS_READ_INTERVAL
When sending ICE or DTLS messages, responses are received via UDP.
static int on_rtp_write_packet(void *opaque, const uint8_t *buf, int buf_size)
Callback triggered by the RTP muxer when it creates and sends out an RTP packet.
int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen)
Same as ff_get_line but strip the white-space characters in the text tail.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
static av_cold void whip_deinit(AVFormatContext *s)
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
char * sdp_offer
This is the SDP offer generated by the muxer based on the codec parameters, DTLS, and ICE information...
enum AVMediaType codec_type
General type of the encoded data.
int ff_dtls_state(URLContext *h)
#define STUN_MAGIC_COOKIE
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static av_cold int dtls_initialize(AVFormatContext *s)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
This struct describes the properties of an encoded stream.
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
#define AVIO_FLAG_READ_WRITE
read-write pseudo flag
@ STUN_ATTR_FINGERPRINT
bind request/response
@ WHIP_STATE_DTLS_FINISHED
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
static int ffurl_write(URLContext *h, const uint8_t *buf, int size)
Write size bytes from buf to the resource accessed by h.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
static av_cold int initialize(AVFormatContext *s)
Initialize and check the options for the WebRTC muxer.
AVStream ** streams
A list of all streams in the file.
static void deinit(AVFormatContext *s)
int strict_std_compliance
Allow non-standard and experimental extension.
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
#define ICE_STUN_HEADER_SIZE
The STUN message header, which is 20 bytes long, comprises the STUNMessageType (1B),...
#define AV_LOG_VERBOSE
Detailed information.
static int is_dtls_packet(uint8_t *b, int size)
Whether the packet is a DTLS packet.
int ffurl_close(URLContext *h)
static int ice_create_request(AVFormatContext *s, uint8_t *buf, int buf_size, int *request_size)
Creates and marshals an ICE binding request packet.
SRTPContext srtp_video_send
int nb_channels
Number of channels in this layout.
static int dtls_context_on_state(AVFormatContext *s, const char *type, const char *desc)
When DTLS state change.
#define WHIP_SDP_CREATOR_IP
int h264_annexb_insert_sps_pps
The h264_mp4toannexb Bitstream Filter (BSF) bypasses the AnnexB packet; therefore,...
static int udp_connect(AVFormatContext *s)
To establish a connection with the UDP server, we utilize ICE-LITE in a Client-Server mode.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
int av_hmac_final(AVHMAC *c, uint8_t *out, unsigned int outlen)
Finish hashing and output the HMAC digest.
#define DTLS_SRTP_CHECKSUM_LEN
The maximum size of the Secure Real-time Transport Protocol (SRTP) HMAC checksum and padding that is ...
char ssl_error_message[256]
@ WHIP_STATE_ICE_CONNECTED
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
#define WHIP_SDP_SESSION_ID
In the case of ICE-LITE, these fields are not used; instead, they are defined as constant values.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
const FFOutputFormat ff_whip_muxer
char cert_buf[MAX_CERTIFICATE_SIZE]
int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size)
@ WHIP_STATE_SRTP_FINISHED
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static int parse_answer(AVFormatContext *s)
Parses the ICE ufrag, pwd, and candidates from the SDP answer.
int ff_srtp_encrypt(struct SRTPContext *s, const uint8_t *in, int len, uint8_t *out, int outlen)
#define WHIP_RTP_PAYLOAD_TYPE_H264
static int ice_handle_binding_request(AVFormatContext *s, char *buf, int buf_size)
This function handles incoming binding request messages by responding to them.
static int h264_annexb_insert_sps_pps(AVFormatContext *s, AVPacket *pkt)
Since the h264_mp4toannexb filter only processes the MP4 ISOM format and bypasses the annexb format,...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PROFILE_UNKNOWN
static int ice_dtls_handshake(AVFormatContext *s)
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent)
Create an URLContext for accessing to the resource indicated by url, and open it.
static int ice_is_binding_request(uint8_t *b, int size)
A Binding request has class=0b00 (request) and method=0b000000000001 (Binding) and is encoded into th...
This struct describes the properties of a single codec described by an AVCodecID.
#define DTLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC
The DTLS content type.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
SRTPContext srtp_audio_send
int flags
Flags modifying the (de)muxer behaviour.
@ STUN_ATTR_USE_CANDIDATE
shared secret response/bind request
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
#define AVIO_FLAG_WRITE
write-only
int av_usleep(unsigned usec)
Sleep for a period of time.
#define DTLS_SRTP_SALT_LEN
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
static int ice_create_response(AVFormatContext *s, char *tid, int tid_size, uint8_t *buf, int buf_size, int *response_size)
Create an ICE binding response.
static int parse_codec(AVFormatContext *s)
Parses video SPS/PPS from the extradata of codecpar and checks the codec.
static int dispose_session(AVFormatContext *s)
RTC is connectionless, for it's based on UDP, so it check whether sesison is timeout.
static unsigned crc32(const uint8_t *data, unsigned size)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_cold int certificate_key_init(AVFormatContext *s)
Get or Generate a self-signed certificate and private key for DTLS, fingerprint for SDP.
uint8_t video_payload_type
const char * av_default_item_name(void *ptr)
Return the context name.
AVIOContext * pb
I/O context.
#define DTLS_SRTP_KEY_LEN
The size of the Secure Real-time Transport Protocol (SRTP) master key material that is exported by Se...
void av_hmac_update(AVHMAC *c, const uint8_t *data, unsigned int len)
Hash data with the HMAC.
char key_buf[MAX_CERTIFICATE_SIZE]
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
static av_cold int whip_init(AVFormatContext *s)
void ffio_fill(AVIOContext *s, int b, int64_t count)
AVChannelLayout ch_layout
Audio only.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
static int media_is_rtp_rtcp(const uint8_t *b, int size)
In RTP packets, the first byte is represented as 0b10xxxxxx, where the initial two bits (0b10) indica...
int sample_rate
Audio only.
int ff_dtls_set_udp(URLContext *h, URLContext *udp)
int extradata_size
Size of the extradata content in bytes.
static const AVClass whip_muxer_class
#define DTLS_RECORD_LAYER_HEADER_LEN
The DTLS record layer header has a total size of 13 bytes, consisting of ContentType (1 byte),...
FFmpeg currently uses a custom build this text attempts to document some of its obscure features and options Makefile the full command issued by make and its output will be shown on the screen DBG Preprocess x86 external assembler files to a dbg asm file in the object which then gets compiled Helps in developing those assembler files DESTDIR Destination directory for the install useful to prepare packages or install FFmpeg in cross environments GEN Set to ‘1’ to generate the missing or mismatched references Makefile builds all the libraries and the executables fate Run the fate test suite
#define MAX_UDP_BUFFER_SIZE
Maximum size of the buffer for sending and receiving UDP packets.
#define WHIP_RTCP_PT_START
For RTCP, PT is [128, 223] (or without marker [0, 95]).
Context structure for the Lagged Fibonacci PRNG.
int(* init)(AVBSFContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
@ STUN_ATTR_MESSAGE_INTEGRITY
bind request
int profile
Codec-specific bitstream restrictions that the stream conforms to.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
static const AVOption options[]
int ff_socket_nonblock(int socket, int enable)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
AVCodecParameters * audio_par
static int parse_profile_level(AVFormatContext *s, AVCodecParameters *par)
When duplicating a stream, the demuxer has already set the extradata, profile, and level of the par.
void ff_srtp_free(struct SRTPContext *s)
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
AVHMAC * av_hmac_alloc(enum AVHMACType type)
Allocate an AVHMAC context.
#define AV_LOG_INFO
Standard information.
#define ELAPSED(starttime, endtime)
void av_hmac_free(AVHMAC *c)
Free an AVHMAC context.
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
static int generate_sdp_offer(AVFormatContext *s)
Generate SDP offer according to the codec parameters, DTLS and ICE information.
#define AV_BASE64_SIZE(x)
Calculate the output size needed to base64-encode x bytes to a null-terminated string.
#define i(width, name, range_min, range_max)
void av_hmac_init(AVHMAC *c, const uint8_t *key, unsigned int keylen)
Initialize an AVHMAC context with an authentication key.
static int exchange_sdp(AVFormatContext *s)
Exchange SDP offer with WebRTC peer to get the answer.
static int whip_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
static int create_rtp_muxer(AVFormatContext *s)
Creates dedicated RTP muxers for each stream in the AVFormatContext to build RTP packets from the enc...
const AVClass ff_avio_class
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static int setup_srtp(AVFormatContext *s)
Establish the SRTP context using the keying material exported from DTLS.
int ff_srtp_set_crypto(struct SRTPContext *s, const char *suite, const char *params)
@ WHIP_STATE_DTLS_CONNECTING
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
const char * ff_http_get_new_location(URLContext *h)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const struct AVOutputFormat * oformat
The output container format.
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
char buf[MAX_UDP_BUFFER_SIZE]
void av_bprintf(AVBPrint *buf, const char *fmt,...)
uint8_t dtls_srtp_materials[(DTLS_SRTP_KEY_LEN+DTLS_SRTP_SALT_LEN) *2]
This represents the material used to build the SRTP master key.
#define AV_PROFILE_H264_CONSTRAINED
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
int ff_dtls_export_materials(URLContext *h, char *dtls_srtp_materials, size_t materials_sz)
@ WHIP_STATE_UDP_CONNECTED
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
static int media_is_rtcp(const uint8_t *b, int size)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
@ WHIP_STATE_ICE_CONNECTING
@ AV_OPT_TYPE_INT
Underlying C type is int.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
#define WHIP_RTP_PAYLOAD_TYPE_OPUS
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
char * ice_protocol
This represents the ICE candidate protocol, priority, host and port.
#define WHIP_RTP_HEADER_SIZE
The RTP header is 12 bytes long, comprising the Version(1B), PT(1B), SequenceNumber(2B),...
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int64_t av_gettime(void)
Get the current time in microseconds.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
#define AVIO_FLAG_READ
read-only
char * av_strdup(const char *s)
Duplicate a string.
const AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
int ff_ssl_read_key_cert(char *key_url, char *cert_url, char *key_buf, size_t key_sz, char *cert_buf, size_t cert_sz, char **fingerprint)
int video_delay
Video only.
#define MAX_CERTIFICATE_SIZE
Maximum size limit of a certificate and private key size.
int64_t start_time_realtime
Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January ...
unsigned char * buffer
Start of the buffer.
int ff_ssl_gen_key_cert(char *key_buf, size_t key_sz, char *cert_buf, size_t cert_sz, char **fingerprint)
char * authorization
The optional Bearer token for WHIP Authorization.
SRTPContext srtp_rtcp_send
int ffurl_handshake(URLContext *c)
Perform one step of the protocol handshake to accept a new client.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
#define AVIO_FLAG_NONBLOCK
Use non-blocking mode.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
void avio_wb16(AVIOContext *s, unsigned int val)
#define DTLS_VERSION_10
The DTLS version number, which is 0xfeff for DTLS 1.0, or 0xfefd for DTLS 1.2.
static int ice_is_binding_response(uint8_t *b, int size)
A Binding response has class=0b10 (success response) and method=0b000000000001, and is encoded into t...
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
uint8_t audio_payload_type
const uint8_t * ff_nal_find_startcode(const uint8_t *p, const uint8_t *end)
AVCodecParameters * video_par
@ WHIP_STATE_NEGOTIATED
After parsing the answer received from the peer, the muxer negotiates the abilities in the offer that...
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
int pkt_size
The size of RTP packet, should generally be set to MTU.
const AVClass * av_class
A class for private options.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
#define MAX_SDP_SIZE
Maximum size limit of a Session Description Protocol (SDP), be it an offer or answer.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static int ffurl_read(URLContext *h, uint8_t *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf.