mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
opusdec: gst_structure_fixate_field_nearest_int() only works if the structure has this field
Just set the rate/channels directly if the caps don't have this field.
This commit is contained in:
parent
ee3135c4a6
commit
cecb83e590
1 changed files with 11 additions and 2 deletions
|
@ -224,10 +224,19 @@ gst_opus_dec_negotiate (GstOpusDec * dec, const GstAudioChannelPosition * pos)
|
|||
caps = gst_caps_truncate (caps);
|
||||
caps = gst_caps_make_writable (caps);
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
gst_structure_fixate_field_nearest_int (s, "rate", dec->sample_rate);
|
||||
|
||||
if (gst_structure_has_field (s, "rate"))
|
||||
gst_structure_fixate_field_nearest_int (s, "rate", dec->sample_rate);
|
||||
else
|
||||
gst_structure_set (s, "rate", G_TYPE_INT, dec->sample_rate, NULL);
|
||||
gst_structure_get_int (s, "rate", &dec->sample_rate);
|
||||
gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels);
|
||||
|
||||
if (gst_structure_has_field (s, "channels"))
|
||||
gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels);
|
||||
else
|
||||
gst_structure_set (s, "channels", G_TYPE_INT, dec->n_channels, NULL);
|
||||
gst_structure_get_int (s, "channels", &dec->n_channels);
|
||||
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue