mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
faac: base class audio info is not yet set during set_format
... since it will only be committed after it has been accepted by subclass. In particular, subclass should not rely on it during its setup.
This commit is contained in:
parent
84c6fdd85e
commit
8bbefbe9cf
1 changed files with 7 additions and 10 deletions
|
@ -122,7 +122,8 @@ static void gst_faac_set_property (GObject * object,
|
||||||
static void gst_faac_get_property (GObject * object,
|
static void gst_faac_get_property (GObject * object,
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||||
|
|
||||||
static gboolean gst_faac_configure_source_pad (GstFaac * faac);
|
static gboolean gst_faac_configure_source_pad (GstFaac * faac,
|
||||||
|
GstAudioInfo * info);
|
||||||
static GstCaps *gst_faac_getcaps (GstAudioEncoder * enc, GstCaps * filter);
|
static GstCaps *gst_faac_getcaps (GstAudioEncoder * enc, GstCaps * filter);
|
||||||
|
|
||||||
static gboolean gst_faac_start (GstAudioEncoder * enc);
|
static gboolean gst_faac_start (GstAudioEncoder * enc);
|
||||||
|
@ -392,7 +393,7 @@ gst_faac_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
|
||||||
faac->format = fmt;
|
faac->format = fmt;
|
||||||
|
|
||||||
/* finish up */
|
/* finish up */
|
||||||
result = gst_faac_configure_source_pad (faac);
|
result = gst_faac_configure_source_pad (faac, info);
|
||||||
if (!result)
|
if (!result)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -464,14 +465,12 @@ gst_faac_negotiate (GstFaac * faac)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_faac_open_encoder (GstFaac * faac)
|
gst_faac_open_encoder (GstFaac * faac, GstAudioInfo * info)
|
||||||
{
|
{
|
||||||
faacEncHandle *handle;
|
faacEncHandle *handle;
|
||||||
faacEncConfiguration *conf;
|
faacEncConfiguration *conf;
|
||||||
guint maxbitrate;
|
guint maxbitrate;
|
||||||
gulong samples, bytes;
|
gulong samples, bytes;
|
||||||
GstAudioInfo *info =
|
|
||||||
gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (faac));
|
|
||||||
|
|
||||||
g_return_val_if_fail (info->rate != 0 && info->channels != 0, FALSE);
|
g_return_val_if_fail (info->rate != 0 && info->channels != 0, FALSE);
|
||||||
|
|
||||||
|
@ -546,17 +545,15 @@ setup_failed:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_faac_configure_source_pad (GstFaac * faac)
|
gst_faac_configure_source_pad (GstFaac * faac, GstAudioInfo * info)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
GstAudioInfo *info =
|
|
||||||
gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (faac));
|
|
||||||
|
|
||||||
/* negotiate stream format */
|
/* negotiate stream format */
|
||||||
gst_faac_negotiate (faac);
|
gst_faac_negotiate (faac);
|
||||||
|
|
||||||
if (!gst_faac_open_encoder (faac))
|
if (!gst_faac_open_encoder (faac, info))
|
||||||
goto set_failed;
|
goto set_failed;
|
||||||
|
|
||||||
/* now create a caps for it all */
|
/* now create a caps for it all */
|
||||||
|
@ -689,7 +686,7 @@ gst_faac_handle_frame (GstAudioEncoder * enc, GstBuffer * in_buf)
|
||||||
if (!in_buf) {
|
if (!in_buf) {
|
||||||
GST_DEBUG_OBJECT (faac, "flushed; recreating encoder");
|
GST_DEBUG_OBJECT (faac, "flushed; recreating encoder");
|
||||||
gst_faac_close_encoder (faac);
|
gst_faac_close_encoder (faac);
|
||||||
if (!gst_faac_open_encoder (faac))
|
if (!gst_faac_open_encoder (faac, gst_audio_encoder_get_audio_info (enc)))
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue