mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 08:08:22 +00:00
rtpjitterbuffer: Don't use glib format modifiers with sscanf
We do not have a way to know the format modifiers to use with string functions provided by the system. G_GUINT64_FORMAT and other string modifiers only work for glib string formatting functions. We cannot use them for string functions provided by the stdlib. See: https://developer.gnome.org/glib/stable/glib-Basic-Types.html#glib-Basic-Types.description ``` ../gst/rtpmanager/gstrtpjitterbuffer.c: In function 'gst_jitter_buffer_sink_parse_caps': ../gst/rtpmanager/gstrtpjitterbuffer.c:1523:32: error: unknown conversion type character 'l' in format [-Werror=format=] || sscanf (mediaclk, "direct=%" G_GUINT64_FORMAT, &clock_offset) != 1) ^~~~~~~~~~ In file included from /home/nirbheek/cerbero/build/dist/windows_x86/include/glib-2.0/glib/gtypes.h:32, from /home/nirbheek/cerbero/build/dist/windows_x86/include/glib-2.0/glib/galloca.h:32, from /home/nirbheek/cerbero/build/dist/windows_x86/include/glib-2.0/glib.h:30, from /home/nirbheek/cerbero/build/dist/windows_x86/include/gstreamer-1.0/gst/gst.h:27, from /home/nirbheek/cerbero/build/dist/windows_x86/include/gstreamer-1.0/gst/rtp/gstrtpbuffer.h:27, from ../gst/rtpmanager/gstrtpjitterbuffer.c:108: /home/nirbheek/cerbero/build/dist/windows_x86/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here #define G_GUINT64_FORMAT "llu" ^ ../gst/rtpmanager/gstrtpjitterbuffer.c:1523:32: error: too many arguments for format [-Werror=format-extra-args] || sscanf (mediaclk, "direct=%" G_GUINT64_FORMAT, &clock_offset) != 1) ^~~~~~~~~~ ``` See also: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/379
This commit is contained in:
parent
35a1cedb97
commit
42e7864e90
1 changed files with 21 additions and 2 deletions
|
@ -1372,6 +1372,24 @@ gst_rtp_jitter_buffer_getcaps (GstPad * pad, GstCaps * filter)
|
|||
return caps;
|
||||
}
|
||||
|
||||
/* g_ascii_string_to_unsigned is available since 2.54. Get rid of this wrapper
|
||||
* when we bump the version in 1.18 */
|
||||
#if !GLIB_CHECK_VERSION(2,54,0)
|
||||
#define g_ascii_string_to_unsigned _gst_jitter_buffer_ascii_string_to_unsigned
|
||||
static gboolean
|
||||
_gst_jitter_buffer_ascii_string_to_unsigned (const gchar * str, guint base,
|
||||
guint64 min, guint64 max, guint64 * out_num, GError ** error)
|
||||
{
|
||||
gchar *endptr = NULL;
|
||||
*out_num = g_ascii_strtoull (str, &endptr, base);
|
||||
if (errno)
|
||||
return FALSE;
|
||||
if (endptr == str)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Must be called with JBUF_LOCK held
|
||||
*/
|
||||
|
@ -1519,8 +1537,9 @@ gst_jitter_buffer_sink_parse_caps (GstRtpJitterBuffer * jitterbuffer,
|
|||
if ((mediaclk = gst_structure_get_string (caps_struct, "a-mediaclk"))) {
|
||||
GST_DEBUG_OBJECT (jitterbuffer, "Got media clock %s", mediaclk);
|
||||
|
||||
if (!g_str_has_prefix (mediaclk, "direct=")
|
||||
|| sscanf (mediaclk, "direct=%" G_GUINT64_FORMAT, &clock_offset) != 1)
|
||||
if (!g_str_has_prefix (mediaclk, "direct=") ||
|
||||
!g_ascii_string_to_unsigned (&mediaclk[8], 10, 0, G_MAXUINT64,
|
||||
&clock_offset, NULL))
|
||||
GST_FIXME_OBJECT (jitterbuffer, "Unsupported media clock");
|
||||
if (strstr (mediaclk, "rate=") != NULL) {
|
||||
GST_FIXME_OBJECT (jitterbuffer, "Rate property not supported");
|
||||
|
|
Loading…
Reference in a new issue