mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
audioaggregator: Consider converting for equal audio formats
The converter might have a non-passthrough mix-matrix. The converter can determine whether it should pass through, so let it, then remove it if it's indeed a passthrough. FIXME: Not converting when we need to but the config is invalid (e.g. because the mix-matrix is not the right size) produces garbage. An invalid config should cause a GST_FLOW_NOT_NEGOTIATED. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1070>
This commit is contained in:
parent
43449d9fb2
commit
a379e0e5f1
1 changed files with 15 additions and 3 deletions
|
@ -200,6 +200,7 @@ gst_audio_aggregator_convert_pad_update_converter (GstAudioAggregatorConvertPad
|
||||||
* aaggcpad, GstAudioInfo * in_info, GstAudioInfo * out_info)
|
* aaggcpad, GstAudioInfo * in_info, GstAudioInfo * out_info)
|
||||||
{
|
{
|
||||||
GstStructure *config = aaggcpad->priv->converter_config;
|
GstStructure *config = aaggcpad->priv->converter_config;
|
||||||
|
GstAudioConverter *converter;
|
||||||
|
|
||||||
if (!aaggcpad->priv->converter_config_changed)
|
if (!aaggcpad->priv->converter_config_changed)
|
||||||
return;
|
return;
|
||||||
|
@ -207,16 +208,27 @@ gst_audio_aggregator_convert_pad_update_converter (GstAudioAggregatorConvertPad
|
||||||
g_clear_pointer (&aaggcpad->priv->converter, gst_audio_converter_free);
|
g_clear_pointer (&aaggcpad->priv->converter, gst_audio_converter_free);
|
||||||
aaggcpad->priv->converter_config_changed = FALSE;
|
aaggcpad->priv->converter_config_changed = FALSE;
|
||||||
|
|
||||||
if (gst_audio_info_is_equal (in_info, out_info) ||
|
if (in_info->finfo->format == GST_AUDIO_FORMAT_UNKNOWN) {
|
||||||
in_info->finfo->format == GST_AUDIO_FORMAT_UNKNOWN) {
|
|
||||||
/* If we haven't received caps yet, this pad should not have
|
/* If we haven't received caps yet, this pad should not have
|
||||||
* a buffer to convert anyway */
|
* a buffer to convert anyway */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aaggcpad->priv->converter =
|
converter =
|
||||||
gst_audio_converter_new (GST_AUDIO_CONVERTER_FLAG_NONE, in_info, out_info,
|
gst_audio_converter_new (GST_AUDIO_CONVERTER_FLAG_NONE, in_info, out_info,
|
||||||
config ? gst_structure_copy (config) : NULL);
|
config ? gst_structure_copy (config) : NULL);
|
||||||
|
|
||||||
|
if (converter == NULL) {
|
||||||
|
/* FIXME: Not converting when we need to but the config is invalid (e.g.
|
||||||
|
* because the mix-matrix is not the right size) produces garbage. An
|
||||||
|
* invalid config should cause a GST_FLOW_NOT_NEGOTIATED. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gst_audio_converter_is_passthrough (converter))
|
||||||
|
aaggcpad->priv->converter = converter;
|
||||||
|
else
|
||||||
|
gst_audio_converter_free (converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue