mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-05 09:00:54 +00:00
opusdec: Use proper guint/guint8 type conversion
Do not cast, that might yield wrong results. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3576>
This commit is contained in:
parent
3e68bd0a11
commit
989e8307b5
1 changed files with 6 additions and 2 deletions
|
@ -363,6 +363,7 @@ gst_opus_dec_parse_header (GstOpusDec * dec, GstBuffer * buf)
|
|||
{
|
||||
GstAudioChannelPosition pos[64];
|
||||
const GstAudioChannelPosition *posn = NULL;
|
||||
guint8 n_channels;
|
||||
|
||||
if (!gst_opus_header_is_id_header (buf)) {
|
||||
GST_ELEMENT_ERROR (dec, STREAM, FORMAT, (NULL),
|
||||
|
@ -372,7 +373,7 @@ gst_opus_dec_parse_header (GstOpusDec * dec, GstBuffer * buf)
|
|||
|
||||
if (!gst_codec_utils_opus_parse_header (buf,
|
||||
&dec->sample_rate,
|
||||
(guint8 *) & dec->n_channels,
|
||||
&n_channels,
|
||||
&dec->channel_mapping_family,
|
||||
&dec->n_streams,
|
||||
&dec->n_stereo_streams,
|
||||
|
@ -381,6 +382,7 @@ gst_opus_dec_parse_header (GstOpusDec * dec, GstBuffer * buf)
|
|||
("Failed to parse Opus ID header"));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
dec->n_channels = n_channels;
|
||||
dec->r128_gain_volume = gst_opus_dec_get_r128_volume (dec->r128_gain);
|
||||
|
||||
GST_INFO_OBJECT (dec,
|
||||
|
@ -886,13 +888,15 @@ gst_opus_dec_set_format (GstAudioDecoder * bdec, GstCaps * caps)
|
|||
}
|
||||
} else {
|
||||
const GstAudioChannelPosition *posn = NULL;
|
||||
guint8 n_channels;
|
||||
|
||||
if (!gst_codec_utils_opus_parse_caps (caps, &dec->sample_rate,
|
||||
(guint8 *) & dec->n_channels, &dec->channel_mapping_family,
|
||||
&n_channels, &dec->channel_mapping_family,
|
||||
&dec->n_streams, &dec->n_stereo_streams, dec->channel_mapping)) {
|
||||
ret = FALSE;
|
||||
goto done;
|
||||
}
|
||||
dec->n_channels = n_channels;
|
||||
|
||||
if (dec->channel_mapping_family == 1 && dec->n_channels <= 8)
|
||||
posn = gst_opus_channel_positions[dec->n_channels - 1];
|
||||
|
|
Loading…
Reference in a new issue