@@ -659,7 +659,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
659
659
if (sdp == NULL || codec == NULL )
660
660
return -1 ;
661
661
/* Check the format string (note that we only parse what browsers can negotiate) */
662
- gboolean video = FALSE, vp9 = FALSE, h264 = FALSE;
662
+ gboolean video = FALSE, vp9 = FALSE, av1 = FALSE, h264 = FALSE;
663
663
const char * format = NULL , * format2 = NULL ;
664
664
if (!strcasecmp (codec , "opus" )) {
665
665
format = "opus/48000/2" ;
@@ -734,7 +734,7 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
734
734
if (pt < 0 ) {
735
735
JANUS_LOG (LOG_ERR , "Invalid payload type (%s)\n" , a -> value );
736
736
} else if (strstr (a -> value , format ) || strstr (a -> value , format2 )) {
737
- if (profile != NULL && (vp9 || h264 )) {
737
+ if (profile != NULL && (vp9 || h264 || av1 )) {
738
738
/* Let's keep track of this payload type */
739
739
pts = g_list_append (pts , GINT_TO_POINTER (pt ));
740
740
} else {
@@ -790,6 +790,15 @@ int janus_sdp_get_codec_pt_full(janus_sdp *sdp, const char *codec, const char *p
790
790
g_list_free (pts );
791
791
return pt ;
792
792
}
793
+ } else if (av1 ) {
794
+ char av1_profile [20 ];
795
+ g_snprintf (av1_profile , sizeof (profile ), "profile=%s" , profile );
796
+ if (strstr (a -> value , av1_profile ) != NULL ) {
797
+ /* Found */
798
+ JANUS_LOG (LOG_VERB , "AV1 profile %s found --> %d\n" , profile , pt );
799
+ g_list_free (pts );
800
+ return pt ;
801
+ }
793
802
}
794
803
}
795
804
ma = ma -> next ;
@@ -1214,7 +1223,7 @@ janus_sdp *janus_sdp_generate_offer(const char *name, const char *address, ...)
1214
1223
gboolean do_audio = TRUE, do_video = TRUE, do_data = TRUE,
1215
1224
audio_dtmf = FALSE, video_rtcpfb = TRUE, data_legacy = TRUE;
1216
1225
const char * audio_codec = NULL , * video_codec = NULL ,
1217
- * vp9_profile = NULL , * h264_profile = NULL ,
1226
+ * vp9_profile = NULL , * av1_profile = NULL , * h264_profile = NULL ,
1218
1227
* audio_fmtp = NULL , * video_fmtp = NULL ;
1219
1228
int audio_pt = 111 , video_pt = 96 , opusred_pt = 0 ;
1220
1229
janus_sdp_mdirection audio_dir = JANUS_SDP_SENDRECV , video_dir = JANUS_SDP_SENDRECV ;
@@ -1238,6 +1247,8 @@ janus_sdp *janus_sdp_generate_offer(const char *name, const char *address, ...)
1238
1247
video_codec = va_arg (args , char * );
1239
1248
} else if (property == JANUS_SDP_OA_VP9_PROFILE ) {
1240
1249
vp9_profile = va_arg (args , char * );
1250
+ } else if (property == JANUS_SDP_OA_AV1_PROFILE ) {
1251
+ av1_profile = va_arg (args , char * );
1241
1252
} else if (property == JANUS_SDP_OA_H264_PROFILE ) {
1242
1253
h264_profile = va_arg (args , char * );
1243
1254
} else if (property == JANUS_SDP_OA_AUDIO_PT ) {
@@ -1430,6 +1441,10 @@ janus_sdp *janus_sdp_generate_offer(const char *name, const char *address, ...)
1430
1441
/* Add a profile-id fmtp attribute */
1431
1442
a = janus_sdp_attribute_create ("fmtp" , "%d profile-id=%s" , video_pt , vp9_profile );
1432
1443
m -> attributes = g_list_append (m -> attributes , a );
1444
+ } else if (!strcasecmp (video_codec , "av1" ) && av1_profile ) {
1445
+ /* Add a profile fmtp attribute */
1446
+ a = janus_sdp_attribute_create ("fmtp" , "%d profile=%s" , video_pt , av1_profile );
1447
+ m -> attributes = g_list_append (m -> attributes , a );
1433
1448
} else if (!strcasecmp (video_codec , "h264" ) && h264_profile ) {
1434
1449
/* Add a profile-level-id fmtp attribute */
1435
1450
a = janus_sdp_attribute_create ("fmtp" , "%d profile-level-id=%s;packetization-mode=1" , video_pt , h264_profile );
@@ -1484,7 +1499,7 @@ janus_sdp *janus_sdp_generate_answer(janus_sdp *offer, ...) {
1484
1499
gboolean do_audio = TRUE, do_video = TRUE, do_data = TRUE,
1485
1500
audio_dtmf = FALSE, audio_opusred = FALSE, video_rtcpfb = TRUE;
1486
1501
const char * audio_codec = NULL , * video_codec = NULL ,
1487
- * vp9_profile = NULL , * h264_profile = NULL ,
1502
+ * vp9_profile = NULL , * av1_profile = NULL , * h264_profile = NULL ,
1488
1503
* audio_fmtp = NULL , * video_fmtp = NULL ;
1489
1504
char * custom_audio_fmtp = NULL ;
1490
1505
GList * extmaps = NULL ;
@@ -1507,6 +1522,8 @@ janus_sdp *janus_sdp_generate_answer(janus_sdp *offer, ...) {
1507
1522
video_codec = va_arg (args , char * );
1508
1523
} else if (property == JANUS_SDP_OA_VP9_PROFILE ) {
1509
1524
vp9_profile = va_arg (args , char * );
1525
+ } else if (property == JANUS_SDP_OA_AV1_PROFILE ) {
1526
+ av1_profile = va_arg (args , char * );
1510
1527
} else if (property == JANUS_SDP_OA_H264_PROFILE ) {
1511
1528
h264_profile = va_arg (args , char * );
1512
1529
} else if (property == JANUS_SDP_OA_AUDIO_DTMF ) {
@@ -1704,6 +1721,8 @@ janus_sdp *janus_sdp_generate_answer(janus_sdp *offer, ...) {
1704
1721
const char * video_profile = NULL ;
1705
1722
if (codec && !strcasecmp (codec , "vp9" ))
1706
1723
video_profile = vp9_profile ;
1724
+ else if (codec && !strcasecmp (codec , "av1" ))
1725
+ video_profile = av1_profile ;
1707
1726
else if (codec && !strcasecmp (codec , "h264" ))
1708
1727
video_profile = h264_profile ;
1709
1728
int pt = janus_sdp_get_codec_pt_full (offer , codec , video_profile );
@@ -1802,6 +1821,10 @@ janus_sdp *janus_sdp_generate_answer(janus_sdp *offer, ...) {
1802
1821
/* Add a profile-id fmtp attribute */
1803
1822
a = janus_sdp_attribute_create ("fmtp" , "%d profile-id=%s" , pt , vp9_profile );
1804
1823
am -> attributes = g_list_append (am -> attributes , a );
1824
+ } else if (!strcasecmp (codec , "av1" ) && av1_profile ) {
1825
+ /* Add a profile fmtp attribute */
1826
+ a = janus_sdp_attribute_create ("fmtp" , "%d profile=%s" , pt , av1_profile );
1827
+ am -> attributes = g_list_append (am -> attributes , a );
1805
1828
} else if (!strcasecmp (codec , "h264" ) && h264_profile ) {
1806
1829
/* Add a profile-level-id fmtp attribute */
1807
1830
a = janus_sdp_attribute_create ("fmtp" , "%d profile-level-id=%s;packetization-mode=1" , pt , h264_profile );
@@ -1856,6 +1879,7 @@ janus_sdp *janus_sdp_generate_answer(janus_sdp *offer, ...) {
1856
1879
/* Check if we need to copy the fmtp attribute too */
1857
1880
if (((!strcasecmp (codec , "vp8" ) && video_fmtp == NULL )) ||
1858
1881
((!strcasecmp (codec , "vp9" ) && vp9_profile == NULL && video_fmtp == NULL )) ||
1882
+ ((!strcasecmp (codec , "av1" ) && av1_profile == NULL && video_fmtp == NULL )) ||
1859
1883
((!strcasecmp (codec , "h264" ) && h264_profile == NULL && video_fmtp == NULL ))) {
1860
1884
/* FIXME Copy the fmtp attribute (we should check if we support it) */
1861
1885
a = janus_sdp_attribute_create ("fmtp" , "%s" , a -> value );
0 commit comments