From 2525a99b9761cbb2f74c1906816d1422021d7600 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sat, 16 Dec 2023 19:14:16 +0300 Subject: [PATCH] module-rtp-sap: parse ptime from incoming streams --- src/modules/module-rtp-sap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/module-rtp-sap.c b/src/modules/module-rtp-sap.c index b6eb7bedf..bf17e106d 100644 --- a/src/modules/module-rtp-sap.c +++ b/src/modules/module-rtp-sap.c @@ -1081,6 +1081,16 @@ static int parse_sdp_a_rtpmap(struct impl *impl, char *c, struct sdp_info *info) return 0; } +static int parse_sdp_a_ptime(struct impl *impl, char *c, struct sdp_info *info) +{ + if (!spa_strstartswith(c, "a=ptime:")) + return 0; + + c += strlen("a=ptime:"); + spa_atof(c, &info->ptime); + return 0; +} + static int parse_sdp_a_mediaclk(struct impl *impl, char *c, struct sdp_info *info) { if (!spa_strstartswith(c, "a=mediaclk:")) @@ -1136,6 +1146,8 @@ static int parse_sdp(struct impl *impl, char *sdp, struct sdp_info *info) res = parse_sdp_m(impl, s, info); else if (spa_strstartswith(s, "a=rtpmap:")) res = parse_sdp_a_rtpmap(impl, s, info); + else if (spa_strstartswith(s, "a=ptime:")) + res = parse_sdp_a_ptime(impl, s, info); else if (spa_strstartswith(s, "a=mediaclk:")) res = parse_sdp_a_mediaclk(impl, s, info); else if (spa_strstartswith(s, "a=ts-refclk:"))