FFmpeg
rtpdec_av1.c
Go to the documentation of this file.
1 /*
2  * Depacketization for RTP Payload Format For AV1 (v1.0)
3  * https://aomediacodec.github.io/av1-rtp-spec/
4  * Copyright (c) 2024 Axis Communications
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * @brief AV1 / RTP depacketization code (RTP Payload Format For AV1 (v1.0))
26  * @author Chris Hodges <chris.hodges@axis.com>
27  * @note The process will restore TDs and put back size fields into headers.
28  * It will also try to keep complete OBUs and remove partial OBUs
29  * caused by packet drops and thus keep the stream syntactically intact.
30  */
31 
32 #include "libavutil/avstring.h"
33 #include "libavutil/mem.h"
34 #include "avformat.h"
35 
36 #include "rtpdec.h"
37 #include "libavcodec/av1.h"
38 #include "rtp_av1.h"
39 
40 // enable tracing of packet data
41 //#define RTPDEC_AV1_VERBOSE_TRACE
42 
43 /**
44  * RTP/AV1 specific private data.
45  */
46 struct PayloadContext {
47  uint32_t timestamp; ///< last received timestamp for frame
48  uint8_t profile; ///< profile (main/high/professional)
49  uint8_t level_idx; ///< level (0-31)
50  uint8_t tier; ///< main tier or high tier
51  uint16_t prev_seq; ///< sequence number of previous packet
52  unsigned int frag_obu_size; ///< current total size of fragmented OBU
53  unsigned int frag_pkt_leb_pos; ///< offset in buffer where OBU LEB starts
54  unsigned int frag_lebs_res; ///< number of bytes reserved for LEB
55  unsigned int frag_header_size; ///< size of OBU header (1 or 2)
56  int needs_td; ///< indicates that a TD should be output
57  int drop_fragment; ///< drop all fragments until next frame
58  int keyframe_seen; ///< keyframe was seen
59  int wait_for_keyframe; ///< message about waiting for keyframe has been issued
60 };
61 
63  AVStream *stream,
64  PayloadContext *av1_data,
65  const char *attr, const char *value) {
66  if (!strcmp(attr, "profile")) {
67  av1_data->profile = atoi(value);
68  av_log(s, AV_LOG_DEBUG, "RTP AV1 profile: %u\n", av1_data->profile);
69  } else if (!strcmp(attr, "level-idx")) {
70  av1_data->level_idx = atoi(value);
71  av_log(s, AV_LOG_DEBUG, "RTP AV1 level: %u\n", av1_data->profile);
72  } else if (!strcmp(attr, "tier")) {
73  av1_data->tier = atoi(value);
74  av_log(s, AV_LOG_DEBUG, "RTP AV1 tier: %u\n", av1_data->tier);
75  }
76  return 0;
77 }
78 
79 // return 0 on complete packet, -1 on partial packet
81  AVStream *st, AVPacket *pkt, uint32_t *timestamp,
82  const uint8_t *buf, int len, uint16_t seq,
83  int flags) {
84  uint8_t aggr_hdr;
85  int result = 0;
86  int is_frag_cont;
87  int is_last_fragmented;
88  int is_first_pkt;
89  unsigned int num_obus;
90  unsigned int obu_cnt = 1;
91  unsigned int rem_pkt_size = len;
92  unsigned int pktpos;
93  const uint8_t *buf_ptr = buf;
94  uint16_t expected_seq = data->prev_seq + 1;
95  int16_t seq_diff = seq - expected_seq;
96 
97  data->prev_seq = seq;
98 
99  if (!len) {
100  av_log(ctx, AV_LOG_ERROR, "Empty AV1 RTP packet\n");
101  return AVERROR_INVALIDDATA;
102  }
103  if (len < 2) {
104  av_log(ctx, AV_LOG_ERROR, "AV1 RTP packet too short\n");
105  return AVERROR_INVALIDDATA;
106  }
107 
108  /* The payload structure is supposed to be straight-forward, but there are a
109  * couple of edge cases which need to be tackled and make things a bit more
110  * complex.
111  * These are mainly due to:
112  * - To reconstruct the OBU size for fragmented packets and place it the OBU
113  * header, the final size will not be known until the last fragment has
114  * been parsed. However, the number LEBs in the header is variable
115  * depending on the length of the payload.
116  * - We are increasing the out-packet size while we are getting fragmented
117  * OBUs. If an RTP packet gets dropped, we would create corrupted OBUs.
118  * In this case we decide to drop the whole frame.
119  */
120 
121 #ifdef RTPDEC_AV1_VERBOSE_TRACE
122  av_log(ctx, AV_LOG_TRACE, "RTP Packet %d in (%x), len=%d:\n",
123  seq, flags, len);
125  av_log(ctx, AV_LOG_TRACE, "... end at offset %x:\n", FFMAX(len - 64, 0));
126  av_hex_dump_log(ctx, AV_LOG_TRACE, buf + FFMAX(len - 64, 0), FFMIN(len - 64, 64));
127 #endif
128 
129  /* 8 bit aggregate header: Z Y W W N - - - */
130  aggr_hdr = *buf_ptr++;
131  rem_pkt_size--;
132 
133  /* Z: MUST be set to 1 if the first OBU element is an OBU fragment that is a
134  * continuation of an OBU fragment from the previous packet, and MUST be set
135  * to 0 otherwise */
136  is_frag_cont = (aggr_hdr >> AV1B_AGGR_HDR_FRAG_CONT) & 1;
137 
138  /* Y: MUST be set to 1 if the last OBU element is an OBU fragment that will
139  * continue in the next packet, and MUST be set to 0 otherwise */
140  is_last_fragmented = (aggr_hdr >> AV1B_AGGR_HDR_LAST_FRAG) & 1;
141 
142  /* W: two bit field that describes the number of OBU elements in the packet.
143  * This field MUST be set equal to 0 or equal to the number of OBU elements
144  * contained in the packet.
145  * If set to 0, each OBU element MUST be preceded by a length field.
146  * If not set to 0 (i.e., W = 1, 2 or 3) the last OBU element MUST NOT be
147  * preceded by a length field (it's derived from RTP packet size minus other
148  * known lengths). */
149  num_obus = (aggr_hdr >> AV1S_AGGR_HDR_NUM_OBUS) & AV1M_AGGR_HDR_NUM_OBUS;
150 
151  /* N: MUST be set to 1 if the packet is the first packet of a coded video
152  * sequence, and MUST be set to 0 otherwise.*/
153  is_first_pkt = (aggr_hdr >> AV1B_AGGR_HDR_FIRST_PKT) & 1;
154 
155  if (is_frag_cont) {
156  if (data->drop_fragment) {
157  return AVERROR_INVALIDDATA;
158  }
159  if (is_first_pkt) {
160  av_log(ctx, AV_LOG_ERROR, "Illegal aggregation header in first AV1 RTP packet\n");
161  return AVERROR_INVALIDDATA;
162  }
163  if (seq_diff) {
164  av_log(ctx, AV_LOG_WARNING, "AV1 RTP frag packet sequence mismatch (%d != %d), dropping temporal unit\n",
165  seq, expected_seq);
166  goto drop_fragment;
167  }
168  if (!pkt->size || !data->frag_obu_size) {
169  av_log(ctx, AV_LOG_WARNING, "Unexpected fragment continuation in AV1 RTP packet\n");
170  goto drop_fragment; // avoid repeated output for the same fragment
171  }
172  } else {
173  if (!is_first_pkt && !data->keyframe_seen) {
174  if (!data->wait_for_keyframe) {
175  data->wait_for_keyframe = 1;
176  av_log(ctx, AV_LOG_WARNING, "AV1 RTP packet before keyframe, dropping and waiting for next keyframe\n");
177  }
178  goto drop_fragment;
179  }
180  if (seq_diff && !is_first_pkt) {
181  av_log(ctx, AV_LOG_WARNING, "AV1 RTP unfrag packet sequence mismatch (%d != %d), dropping temporal unit\n",
182  seq, expected_seq);
183  goto drop_fragment;
184  }
185  data->drop_fragment = 0;
186  if (!data->needs_td && ((data->timestamp != *timestamp) || is_first_pkt)) {
187  av_log(ctx, AV_LOG_TRACE, "Timestamp changed to %u (or first pkt %d), forcing TD\n", *timestamp, is_first_pkt);
188  data->needs_td = 1;
189  data->frag_obu_size = 0; // new temporal unit might have been caused by dropped packets
190  }
191  if (data->frag_obu_size) {
192  data->frag_obu_size = 0; // make sure we recover
193  av_log(ctx, AV_LOG_ERROR, "Missing fragment continuation in AV1 RTP packet\n");
194  return AVERROR_INVALIDDATA;
195  }
196  // update the timestamp in the frame packet with the one from the RTP packet
197  data->timestamp = *timestamp;
198  }
199  pktpos = pkt->size;
200 
201 #ifdef RTPDEC_AV1_VERBOSE_TRACE
202  av_log(ctx, AV_LOG_TRACE, "Input buffer size %d, aggr head 0x%02x fc %d, lf %d, no %d, fp %d\n",
203  len, aggr_hdr, is_frag_cont, is_last_fragmented, num_obus, is_first_pkt);
204 #endif
205 
206  if (is_first_pkt) {
208  data->keyframe_seen = 1;
209  data->wait_for_keyframe = 0;
210  }
211 
212  // loop over OBU elements
213  while (rem_pkt_size) {
214  uint32_t obu_size;
215  int num_lebs;
216  int needs_size_field;
217  int output_size;
218  unsigned int obu_payload_size;
219  uint8_t obu_hdr;
220 
221  obu_size = rem_pkt_size;
222  if (!num_obus || obu_cnt < num_obus) {
223  // read out explicit OBU element size (which almost corresponds to the original OBU size)
224  num_lebs = parse_leb(ctx, buf_ptr, rem_pkt_size, &obu_size);
225  if (!num_lebs) {
226  return AVERROR_INVALIDDATA;
227  }
228  rem_pkt_size -= num_lebs;
229  buf_ptr += num_lebs;
230  }
231  // read first byte (which is the header byte only for non-fragmented elements)
232  obu_hdr = *buf_ptr;
233  if (obu_size > rem_pkt_size) {
234  av_log(ctx, AV_LOG_ERROR, "AV1 OBU size %u larger than remaining pkt size %d\n", obu_size, rem_pkt_size);
235  return AVERROR_INVALIDDATA;
236  }
237 
238  if (!obu_size) {
239  av_log(ctx, AV_LOG_ERROR, "Unreasonable AV1 OBU size %u\n", obu_size);
240  return AVERROR_INVALIDDATA;
241  }
242 
243  if (!is_frag_cont) {
244  uint8_t obu_type = (obu_hdr >> AV1S_OBU_TYPE) & AV1M_OBU_TYPE;
245  if (obu_hdr & AV1F_OBU_FORBIDDEN) {
246  av_log(ctx, AV_LOG_ERROR, "Forbidden bit set in AV1 OBU header (0x%02x)\n", obu_hdr);
247  return AVERROR_INVALIDDATA;
248  }
249  // ignore and remove OBUs according to spec
250  if ((obu_type == AV1_OBU_TEMPORAL_DELIMITER) ||
251  (obu_type == AV1_OBU_TILE_LIST)) {
252  buf_ptr += obu_size;
253  rem_pkt_size -= obu_size;
254  // TODO: This probably breaks if the OBU_TILE_LIST is fragmented
255  // into the next RTP packet, so at least check and fail here
256  if (rem_pkt_size == 0 && is_last_fragmented) {
257  avpriv_report_missing_feature(ctx, "AV1 OBU_TILE_LIST (should not be there!) to be ignored but is fragmented\n");
258  return AVERROR_PATCHWELCOME;
259  }
260  obu_cnt++;
261  continue;
262  }
263  }
264 
265  // If we need to add a size field, out size will be different
266  output_size = obu_size;
267  // Spec says the OBUs should have their size fields removed,
268  // but this is not mandatory
269  if (is_frag_cont || (obu_hdr & AV1F_OBU_HAS_SIZE_FIELD)) {
270  needs_size_field = 0;
271  } else {
272  needs_size_field = 1;
273  // (re)calculate number of LEB bytes needed (if it was implicit, there were no LEBs)
274  output_size += calc_leb_size(obu_size - (1 + ((obu_hdr & AV1F_OBU_EXTENSION_FLAG) ? 1 : 0)));
275  }
276 
277  if (!is_frag_cont && (obu_cnt == 1)) {
278  if (data->needs_td) {
279  output_size += 2; // for Temporal Delimiter (TD)
280  }
281  result = av_grow_packet(pkt, output_size);
282  if (result < 0)
283  return result;
284 
285  if (data->needs_td) {
286  // restore TD
287  pkt->data[pktpos++] = 0x12;
288  pkt->data[pktpos++] = 0x00;
289  }
290  data->needs_td = 0;
291  } else {
292  if ((result = av_grow_packet(pkt, output_size)) < 0)
293  return result;
294  }
295 
296  obu_payload_size = obu_size;
297  // do we need to restore the OBU size field?
298  if (needs_size_field) {
299  // set obu_has_size_field in header byte
300  pkt->data[pktpos++] = *buf_ptr++ | AV1F_OBU_HAS_SIZE_FIELD;
301  data->frag_header_size = 1;
302  obu_payload_size--;
303 
304  // copy extension byte, if available
305  if (obu_hdr & AV1F_OBU_EXTENSION_FLAG) {
306  /* TODO we cannot handle the edge case where last element is a
307  * fragment of exactly one byte AND the header has the extension
308  * flag set. Note that it would be more efficient to not send a
309  * fragment of one byte and instead drop the size field of the
310  * prior element */
311  if (!obu_payload_size) {
312  av_log(ctx, AV_LOG_ERROR, "AV1 OBU too short for extension byte (0x%02x)\n",
313  obu_hdr);
314  return AVERROR_INVALIDDATA;
315  }
316  pkt->data[pktpos++] = *buf_ptr++;
317  data->frag_header_size = 2;
318  obu_payload_size--;
319  }
320 
321  // remember start position of LEB for possibly fragmented packet to
322  // fixup OBU size later
323  data->frag_pkt_leb_pos = pktpos;
324  // write intermediate OBU size field
325  num_lebs = write_leb(pkt->data + pktpos, obu_payload_size);
326  data->frag_lebs_res = num_lebs;
327  pktpos += num_lebs;
328  } else if (!is_frag_cont) {
329  data->frag_lebs_res = 0;
330  }
331  // copy verbatim or without above header size patch
332  memcpy(pkt->data + pktpos, buf_ptr, obu_payload_size);
333  pktpos += obu_payload_size;
334  buf_ptr += obu_payload_size;
335  rem_pkt_size -= obu_size;
336 
337  // if we were handling a fragmented packet and this was the last
338  // fragment, correct OBU size field
339  if (data->frag_obu_size && (rem_pkt_size || !is_last_fragmented)) {
340  if (data->frag_lebs_res) {
341  uint32_t final_obu_size = data->frag_obu_size + obu_size - data->frag_header_size;
342  uint8_t *lebptr = pkt->data + data->frag_pkt_leb_pos;
343  num_lebs = calc_leb_size(final_obu_size);
344 
345  // check if we had allocated enough LEB bytes in header,
346  // otherwise make some extra space
347  if (num_lebs > data->frag_lebs_res) {
348  int extra_bytes = num_lebs - data->frag_lebs_res;
349  if ((result = av_grow_packet(pkt, extra_bytes)) < 0)
350  return result;
351  // update pointer in case buffer address changed
352  lebptr = pkt->data + data->frag_pkt_leb_pos;
353  // move existing data for OBU back a bit
354  memmove(lebptr + extra_bytes, lebptr,
355  pkt->size - extra_bytes - data->frag_pkt_leb_pos);
356  // move pktpos further down for following OBUs in same packet.
357  pktpos += extra_bytes;
358  }
359 
360  // update OBU size field
361  write_leb(lebptr, final_obu_size);
362  }
363  data->frag_obu_size = 0; // signal end of fragment
364  } else if (is_last_fragmented && !rem_pkt_size) {
365  data->frag_obu_size += obu_size;
366  // fragment not yet finished!
367  result = -1;
368  }
369  is_frag_cont = 0;
370 
371  if (!rem_pkt_size && num_obus && (num_obus != obu_cnt)) {
372  av_log(ctx, AV_LOG_WARNING, "AV1 aggregation header indicated %u OBU elements, was %u\n",
373  num_obus, obu_cnt);
374  }
375  obu_cnt++;
376  }
377 
378  if (flags & RTP_FLAG_MARKER) {
379  av_log(ctx, AV_LOG_TRACE, "TD on next packet due to marker\n");
380  data->needs_td = 1;
381  } else {
382  // fragment may be complete, but temporal unit is not yet finished
383  result = -1;
384  }
385 
386  if (!is_last_fragmented) {
387  data->frag_obu_size = 0;
388  data->frag_pkt_leb_pos = 0;
389  }
390 
391 #ifdef RTPDEC_AV1_VERBOSE_TRACE
392  if (!result) {
393  av_log(ctx, AV_LOG_TRACE, "AV1 out pkt-size: %d\n", pkt->size);
395  av_log(ctx, AV_LOG_TRACE, "... end at offset %x:\n", FFMAX(pkt->size - 64, 0));
396  av_hex_dump_log(ctx, AV_LOG_TRACE, pkt->data + FFMAX(pkt->size - 64, 0), FFMIN(pkt->size, 64));
397  }
398 #endif
399  pkt->stream_index = st->index;
400 
401  return result;
402 
403 drop_fragment:
404  data->keyframe_seen = 0;
405  data->drop_fragment = 1;
406  data->frag_obu_size = 0;
407  data->needs_td = 1;
408  if (pkt->size) {
409  av_log(ctx, AV_LOG_TRACE, "Dumping current AV1 frame packet\n");
410  // we can't seem to deallocate the fragmented packet, but we can shrink it to 0
411  av_shrink_packet(pkt, 0);
412  }
413  return AVERROR_INVALIDDATA;
414 }
415 
417 }
418 
420 {
421  return !data->keyframe_seen;
422 }
423 
424 static int parse_av1_sdp_line(AVFormatContext *s, int st_index,
425  PayloadContext *av1_data, const char *line) {
426  AVStream * stream;
427  const char *p = line;
428  int result = 0;
429 
430  if (st_index < 0)
431  return 0;
432 
433  stream = s->streams[st_index];
434 
435  /* Optional parameters are profile, level-idx, and tier.
436  * See Section 7.2.1 of https://aomediacodec.github.io/av1-rtp-spec/ */
437  if (av_strstart(p, "fmtp:", &p)) {
438  result = ff_parse_fmtp(s, stream, av1_data, p, sdp_parse_fmtp_config_av1);
439  av_log(s, AV_LOG_DEBUG, "RTP AV1 Profile: %u, Level: %u, Tier: %u\n",
440  av1_data->profile, av1_data->level_idx, av1_data->tier);
441  }
442 
443  return result;
444 }
445 
447  .enc_name = "AV1",
448  .codec_type = AVMEDIA_TYPE_VIDEO,
449  .codec_id = AV_CODEC_ID_AV1,
450  .need_parsing = AVSTREAM_PARSE_FULL,
451  .priv_data_size = sizeof(PayloadContext),
452  .parse_sdp_a_line = parse_av1_sdp_line,
455  .need_keyframe = av1_need_keyframe,
456 };
flags
const SwsFlags flags[]
Definition: swscale.c:72
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
AV1M_AGGR_HDR_NUM_OBUS
#define AV1M_AGGR_HDR_NUM_OBUS
Definition: rtp_av1.h:53
ff_parse_fmtp
int ff_parse_fmtp(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *p, int(*parse_fmtp)(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *attr, const char *value))
Definition: rtpdec.c:945
av_grow_packet
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
Definition: packet.c:121
RTP_FLAG_MARKER
#define RTP_FLAG_MARKER
RTP marker bit was set for this packet.
Definition: rtpdec.h:94
AVPacket::data
uint8_t * data
Definition: packet.h:595
data
const char data[16]
Definition: mxf.c:149
AV1S_OBU_TYPE
#define AV1S_OBU_TYPE
Definition: rtp_av1.h:39
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
ff_av1_dynamic_handler
const RTPDynamicProtocolHandler ff_av1_dynamic_handler
Definition: rtpdec_av1.c:446
AV1_OBU_TEMPORAL_DELIMITER
@ AV1_OBU_TEMPORAL_DELIMITER
Definition: av1.h:31
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:650
write_leb
static unsigned int write_leb(uint8_t *lebptr, uint32_t length)
write out variable number of LEB bytes for the given length
Definition: rtp_av1.h:68
PayloadContext::level_idx
uint8_t level_idx
level (0-31)
Definition: rtpdec_av1.c:49
PayloadContext::tier
uint8_t tier
main tier or high tier
Definition: rtpdec_av1.c:50
PayloadContext::timestamp
uint32_t timestamp
last received timestamp for frame
Definition: rtpdec_ac3.c:31
RTPDynamicProtocolHandler::enc_name
const char * enc_name
Definition: rtpdec.h:117
close
static av_cold void close(AVCodecParserContext *s)
Definition: apv_parser.c:197
av_shrink_packet
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
Definition: packet.c:113
PayloadContext::frag_lebs_res
unsigned int frag_lebs_res
number of bytes reserved for LEB
Definition: rtpdec_av1.c:54
PayloadContext::frag_pkt_leb_pos
unsigned int frag_pkt_leb_pos
offset in buffer where OBU LEB starts
Definition: rtpdec_av1.c:53
AV1F_OBU_FORBIDDEN
#define AV1F_OBU_FORBIDDEN
Definition: rtp_av1.h:38
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:236
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AV1F_OBU_HAS_SIZE_FIELD
#define AV1F_OBU_HAS_SIZE_FIELD
Definition: rtp_av1.h:44
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV1B_AGGR_HDR_FRAG_CONT
#define AV1B_AGGR_HDR_FRAG_CONT
Definition: rtp_av1.h:48
PayloadContext::frag_obu_size
unsigned int frag_obu_size
current total size of fragmented OBU
Definition: rtpdec_av1.c:52
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
AV1F_OBU_EXTENSION_FLAG
#define AV1F_OBU_EXTENSION_FLAG
Definition: rtp_av1.h:42
AVFormatContext
Format I/O context.
Definition: avformat.h:1283
result
and forward the result(frame or status change) to the corresponding input. If nothing is possible
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:284
av1_need_keyframe
static int av1_need_keyframe(PayloadContext *data)
Definition: rtpdec_av1.c:419
PayloadContext::prev_seq
uint16_t prev_seq
sequence number of previous packet
Definition: rtpdec_av1.c:51
parse_av1_sdp_line
static int parse_av1_sdp_line(AVFormatContext *s, int st_index, PayloadContext *av1_data, const char *line)
Definition: rtpdec_av1.c:424
PayloadContext::profile
uint8_t profile
profile (main/high/professional)
Definition: rtpdec_av1.c:48
av1_close_context
static void av1_close_context(PayloadContext *data)
Definition: rtpdec_av1.c:416
rtpdec.h
PayloadContext::frag_header_size
unsigned int frag_header_size
size of OBU header (1 or 2)
Definition: rtpdec_av1.c:55
AVPacket::size
int size
Definition: packet.h:596
sdp_parse_fmtp_config_av1
static int sdp_parse_fmtp_config_av1(AVFormatContext *s, AVStream *stream, PayloadContext *av1_data, const char *attr, const char *value)
Definition: rtpdec_av1.c:62
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
av1.h
PayloadContext::needs_td
int needs_td
indicates that a TD should be output
Definition: rtpdec_av1.c:56
line
Definition: graph2dot.c:48
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:601
av_strstart
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
Definition: avstring.c:36
calc_leb_size
static unsigned int calc_leb_size(uint32_t length)
calculate number of required LEB bytes for the given length
Definition: rtp_av1.h:58
value
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 default value
Definition: writing_filters.txt:86
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV1M_OBU_TYPE
#define AV1M_OBU_TYPE
Definition: rtp_av1.h:40
parse_leb
static unsigned int parse_leb(void *logctx, const uint8_t *buf_ptr, uint32_t buffer_size, uint32_t *obu_size)
securely parse LEB bytes and return the resulting encoded length
Definition: rtp_av1.h:95
len
int len
Definition: vorbis_enc_data.h:426
AVStream
Stream structure.
Definition: avformat.h:746
AV1_OBU_TILE_LIST
@ AV1_OBU_TILE_LIST
Definition: av1.h:37
av_hex_dump_log
void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the log.
Definition: dump.c:88
avformat.h
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:752
rtp_av1.h
shared defines and functions for AV1 RTP dec/enc
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
AVPacket::stream_index
int stream_index
Definition: packet.h:597
parse_packet
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index, int flush)
Parse a packet, add all split parts to parse_queue.
Definition: demux.c:1178
PayloadContext::drop_fragment
int drop_fragment
drop all fragments until next frame
Definition: rtpdec_av1.c:57
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
AV1B_AGGR_HDR_FIRST_PKT
#define AV1B_AGGR_HDR_FIRST_PKT
Definition: rtp_av1.h:54
mem.h
AV1B_AGGR_HDR_LAST_FRAG
#define AV1B_AGGR_HDR_LAST_FRAG
Definition: rtp_av1.h:50
AVPacket
This structure stores compressed data.
Definition: packet.h:572
AV1S_AGGR_HDR_NUM_OBUS
#define AV1S_AGGR_HDR_NUM_OBUS
Definition: rtp_av1.h:52
AVSTREAM_PARSE_FULL
@ AVSTREAM_PARSE_FULL
full parsing and repack
Definition: avformat.h:591
PayloadContext::wait_for_keyframe
int wait_for_keyframe
message about waiting for keyframe has been issued
Definition: rtpdec_av1.c:59
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
av1_handle_packet
static int av1_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
Definition: rtpdec_av1.c:80
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
pkt
static AVPacket * pkt
Definition: demux_decode.c:55
avstring.h
PayloadContext
RTP/AV1 specific private data.
Definition: rdt.c:85
PayloadContext::keyframe_seen
int keyframe_seen
keyframe was seen
Definition: rtpdec_av1.c:58
line
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
Definition: swscale.txt:40
RTPDynamicProtocolHandler
Definition: rtpdec.h:116