[vlc-commits] [Git][videolan/vlc][master] 3 commits: rtp: h264: use vlc_sdp helpers
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri May 17 04:50:25 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a6bc2fd1 by Marvin Scholz at 2024-05-17T04:14:03+00:00
rtp: h264: use vlc_sdp helpers
Fixes parsing of these parameter names to be properly case-insensitive
as per RFC 4855 Section 3:
Similarly, parameter names are case-insensitive both
in media type strings and in the default mapping to the SDP a=fmtp
attribute.
- - - - -
531530b0 by Marvin Scholz at 2024-05-17T04:14:03+00:00
rtp: h264: allow missing packetization-mode
According to RFC 6184 Section 6.2, a missing packetization-mode
indicates the Single NAS Unit Mode, the same as a mode of 0.
- - - - -
1fb04ec9 by Marvin Scholz at 2024-05-17T04:14:03+00:00
rtp: h265: use vlc_sdp helpers
Fixes parsing of these parameter names to be properly case-insensitive
as per RFC 4855 Section 3:
Similarly, parameter names are case-insensitive both
in media type strings and in the default mapping to the SDP a=fmtp
attribute.
- - - - -
2 changed files:
- modules/access/rtp/h264.c
- modules/access/rtp/h265.c
Changes:
=====================================
modules/access/rtp/h264.c
=====================================
@@ -25,6 +25,7 @@
#include <assert.h>
#include "h26x.h"
+#include "fmtp.h"
#include <vlc_plugin.h>
#include <vlc_codec.h>
@@ -271,8 +272,9 @@ static int rtp_h264_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
if(!desc->parameters)
return VLC_ENOTSUP;
- const char *psz = strstr(desc->parameters, "packetization-mode=");
- if(!psz || psz[19] == '\0' || atoi(&psz[19]) > 1)
+ uint8_t mode = 0;
+ int ret = vlc_sdp_fmtp_get(desc, "packetization-mode", &mode);
+ if ((ret && ret != -ENOENT) || mode > 1)
return VLC_ENOTSUP;
if (vlc_ascii_strcasecmp(desc->name, "H264") == 0)
@@ -287,12 +289,10 @@ static int rtp_h264_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
opaque->obj = obj;
- if(desc->parameters)
- {
- psz = strstr(desc->parameters, "sprop-parameter-sets=");
- if(psz)
- opaque->sdpxps = h26x_fillextradata(psz + 21);
- }
+ size_t sprop_len;
+ const char *sprop = vlc_sdp_fmtp_get_str(desc, "sprop-parameter-sets", &sprop_len);
+ if (sprop && sprop_len)
+ opaque->sdpxps = h26x_fillextradata(sprop);
return VLC_SUCCESS;
}
=====================================
modules/access/rtp/h265.c
=====================================
@@ -25,6 +25,7 @@
#include <assert.h>
#include "h26x.h"
+#include "fmtp.h"
#define FLAG_DONL 1
@@ -296,25 +297,23 @@ static int rtp_h265_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
opaque->obj = obj;
- if(desc->parameters)
- {
- const char *psz = strstr(desc->parameters, "sprop-max-don-diff=");
- if(psz)
- opaque->b_donl = (atoi(psz + 19) > 0);
- block_t **append = &opaque->sdpxps;
- const char *props[] = { "sprop-vps=", "sprop-sps=", "sprop-pps=" };
- for(int i=0; i<ARRAY_SIZE(props); i++)
- {
- psz = strstr(desc->parameters, props[i]);
- if(!psz)
- continue;
- block_t *xps = h26x_fillextradata(psz + 10);
- if(xps)
- block_ChainLastAppend(&append, xps);
- }
- if(opaque->sdpxps)
- opaque->sdpxps = block_ChainGather(opaque->sdpxps);
+ uint16_t don_diff;
+ if(!vlc_sdp_fmtp_get(desc, "sprop-max-don-diff", &don_diff))
+ opaque->b_donl = (don_diff > 0);
+
+ block_t **append = &opaque->sdpxps;
+ const char *props[] = { "sprop-vps", "sprop-sps", "sprop-pps" };
+ for(size_t i=0; i<ARRAY_SIZE(props); i++) {
+ size_t len;
+ const char *value = vlc_sdp_fmtp_get_str(desc, props[i], &len);
+ if(!value || len == 0)
+ continue;
+ block_t *xps = h26x_fillextradata(value);
+ if(xps)
+ block_ChainLastAppend(&append, xps);
}
+ if(opaque->sdpxps)
+ opaque->sdpxps = block_ChainGather(opaque->sdpxps);
return VLC_SUCCESS;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8205482c3ad8436c244f04b7a09e94b7acf9c66e...1fb04ec98ba0a813cf984cf077c3c27cb6297191
--
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8205482c3ad8436c244f04b7a09e94b7acf9c66e...1fb04ec98ba0a813cf984cf077c3c27cb6297191
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list