[0.11] gst-plugins-bad: faac: base class audio info is not yet set during set_format

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Wed Jan 11 04:01:12 PST 2012


Module: gst-plugins-bad
Branch: 0.11
Commit: 8bbefbe9cf379505bfd9de62410ed7187bb957bb
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=8bbefbe9cf379505bfd9de62410ed7187bb957bb

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Wed Jan 11 12:57:19 2012 +0100

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.

---

 ext/faac/gstfaac.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index 5a94bc5..ecae7da 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -122,7 +122,8 @@ static void gst_faac_set_property (GObject * object,
 static void gst_faac_get_property (GObject * object,
     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 gboolean gst_faac_start (GstAudioEncoder * enc);
@@ -392,7 +393,7 @@ gst_faac_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
   faac->format = fmt;
 
   /* finish up */
-  result = gst_faac_configure_source_pad (faac);
+  result = gst_faac_configure_source_pad (faac, info);
   if (!result)
     goto done;
 
@@ -464,14 +465,12 @@ gst_faac_negotiate (GstFaac * faac)
 }
 
 static gboolean
-gst_faac_open_encoder (GstFaac * faac)
+gst_faac_open_encoder (GstFaac * faac, GstAudioInfo * info)
 {
   faacEncHandle *handle;
   faacEncConfiguration *conf;
   guint maxbitrate;
   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);
 
@@ -546,17 +545,15 @@ setup_failed:
 }
 
 static gboolean
-gst_faac_configure_source_pad (GstFaac * faac)
+gst_faac_configure_source_pad (GstFaac * faac, GstAudioInfo * info)
 {
   GstCaps *srccaps;
   gboolean ret;
-  GstAudioInfo *info =
-      gst_audio_encoder_get_audio_info (GST_AUDIO_ENCODER (faac));
 
   /* negotiate stream format */
   gst_faac_negotiate (faac);
 
-  if (!gst_faac_open_encoder (faac))
+  if (!gst_faac_open_encoder (faac, info))
     goto set_failed;
 
   /* now create a caps for it all */
@@ -689,7 +686,7 @@ gst_faac_handle_frame (GstAudioEncoder * enc, GstBuffer * in_buf)
     if (!in_buf) {
       GST_DEBUG_OBJECT (faac, "flushed; recreating encoder");
       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;
     }
   }



More information about the gstreamer-commits mailing list