aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtpenc.c
diff options
context:
space:
mode:
authorChris Hodges <chrishod@axis.com>2024-08-26 11:29:29 +0200
committerRonald S. Bultje <rsbultje@gmail.com>2025-02-26 12:32:22 -0500
commit330c8f8b936de66d08d5c462845e7fdcbc637b75 (patch)
tree32f3dae718734443cab19858f813c6c3c06899dc /libavformat/rtpenc.c
parentb3d73df80d722ca329a2747ac5dba4476bd82e99 (diff)
downloadffmpeg-330c8f8b936de66d08d5c462845e7fdcbc637b75.tar.gz
avformat: add AV1 RTP depacketizer and packetizer
Add RTP packetizer and depacketizer according to (most) of the official AV1 RTP specification. This enables streaming via RTSP between ffmpeg and ffmpeg and has also been tested to work with AV1 RTSP streams via GStreamer. It also adds the required SDP attributes for AV1. AV1 RTP encoding is marked as experimental due to draft specification status, debug amount reduced and other changes suggested by Tristan. Added optional code for searching the sequence header to determine the first packet for broken AV1 encoders / parsers. Stops depacketizing on corruption until next keyframe, no longer prematurely issues packet on decoding if temporal unit was not complete yet. Change-Id: I90f5c5b9d577908a0d713606706b5654fde5f910 Signed-off-by: Chris Hodges <chrishod@axis.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/rtpenc.c')
-rw-r--r--libavformat/rtpenc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 7b4ae37d13..3db13ee0b2 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -79,6 +79,7 @@ static int is_supported(enum AVCodecID id)
case AV_CODEC_ID_THEORA:
case AV_CODEC_ID_VP8:
case AV_CODEC_ID_VP9:
+ case AV_CODEC_ID_AV1:
case AV_CODEC_ID_ADPCM_G722:
case AV_CODEC_ID_ADPCM_G726:
case AV_CODEC_ID_ADPCM_G726LE:
@@ -228,6 +229,16 @@ static int rtp_write_header(AVFormatContext *s1)
goto fail;
}
break;
+ case AV_CODEC_ID_AV1:
+ if (s1->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ av_log(s, AV_LOG_ERROR,
+ "Packetizing AV1 is experimental and its specification is "
+ "still in draft state. "
+ "Please set -strict experimental in order to enable it.\n");
+ ret = AVERROR_EXPERIMENTAL;
+ goto fail;
+ }
+ break;
case AV_CODEC_ID_VORBIS:
case AV_CODEC_ID_THEORA:
s->max_frames_per_packet = 15;
@@ -579,6 +590,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
case AV_CODEC_ID_AMR_WB:
ff_rtp_send_amr(s1, pkt->data, size);
break;
+ case AV_CODEC_ID_AV1:
+ ff_rtp_send_av1(s1, pkt->data, size, (pkt->flags & AV_PKT_FLAG_KEY) ? 1 : 0);
+ break;
case AV_CODEC_ID_MPEG2TS:
rtp_send_mpegts_raw(s1, pkt->data, size);
break;