mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
rtpopusdepay: Assume 48 kHz if sprop-maxcapturerate is missing
This matches 7587, section 6.1: > sprop-maxcapturerate: a hint about the maximum input sampling rate > [...] > bandwidths (Table 1). By default, the sender is assumed to have > no limitations, i.e., 48000. Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2354 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4172>
This commit is contained in:
parent
dbaca4418d
commit
0dd60e06e8
1 changed files with 9 additions and 4 deletions
|
@ -100,6 +100,8 @@ gst_rtp_opus_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
const gchar *sprop_maxcapturerate;
|
const gchar *sprop_maxcapturerate;
|
||||||
|
/* Default unless overridden by sprop_maxcapturerate */
|
||||||
|
gint rate = 48000;
|
||||||
|
|
||||||
srccaps = gst_caps_new_empty_simple ("audio/x-opus");
|
srccaps = gst_caps_new_empty_simple ("audio/x-opus");
|
||||||
|
|
||||||
|
@ -215,19 +217,22 @@ gst_rtp_opus_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
|
||||||
|
|
||||||
if ((sprop_maxcapturerate =
|
if ((sprop_maxcapturerate =
|
||||||
gst_structure_get_string (s, "sprop-maxcapturerate"))) {
|
gst_structure_get_string (s, "sprop-maxcapturerate"))) {
|
||||||
gulong rate;
|
|
||||||
gchar *tailptr;
|
gchar *tailptr;
|
||||||
|
gulong tmp_rate;
|
||||||
|
|
||||||
rate = strtoul (sprop_maxcapturerate, &tailptr, 10);
|
tmp_rate = strtoul (sprop_maxcapturerate, &tailptr, 10);
|
||||||
if (rate > INT_MAX || *tailptr != '\0') {
|
if (tmp_rate > INT_MAX || *tailptr != '\0') {
|
||||||
GST_WARNING_OBJECT (depayload,
|
GST_WARNING_OBJECT (depayload,
|
||||||
"Failed to parse sprop-maxcapturerate value '%s'",
|
"Failed to parse sprop-maxcapturerate value '%s'",
|
||||||
sprop_maxcapturerate);
|
sprop_maxcapturerate);
|
||||||
} else {
|
} else {
|
||||||
gst_caps_set_simple (srccaps, "rate", G_TYPE_INT, rate, NULL);
|
/* Valid rate from sprop, let's use it */
|
||||||
|
rate = tmp_rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_caps_set_simple (srccaps, "rate", G_TYPE_INT, rate, NULL);
|
||||||
|
|
||||||
ret = gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
ret = gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (depayload,
|
GST_DEBUG_OBJECT (depayload,
|
||||||
|
|
Loading…
Reference in a new issue