Help needed to diagnose critical error message while setting tags on flac stream

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help needed to diagnose critical error message while setting tags on flac stream

Yogesh Marwaha
Hi,

I'm trying to write tags to a flac file. Here is the relevant code: -

GstElement* FlacEncoder::createPipeline(GstElement* source, const QString
&file) const{
    if(!source)
        return 0;
    //pipeline
    GstElement *pipeline = gst_pipeline_new("flac-encoder");
    //encoder
    GstElement *encoder = gst_element_factory_make("flacenc", "flac-encoder-
element");
    g_object_set(G_OBJECT(encoder), "quality", mCompressionQuality, NULL);
    //tagger
    GstElement *tagger = gst_element_factory_make("flactag", "flac-encoder-
tag-element");
    GstTagSetter *tagSetter = GST_TAG_SETTER(tagger);
    GValue value = {0};
    g_value_init(&value, G_TYPE_STRING);
    g_value_set_static_string(&value, "Hello");
    gst_tag_setter_add_tag_value(tagSetter, GST_TAG_MERGE_REPLACE, "title",
&value);
    g_value_unset(&value);
    g_value_init(&value, G_TYPE_STRING);
    g_value_set_static_string(&value, "Monty");
    gst_tag_setter_add_tag_value(tagSetter, GST_TAG_MERGE_REPLACE, "composer",
&value);
    //sink
    GstElement *sink = gst_element_factory_make("filesink", "flac-encoder-
sink");
    gchar *location = g_strdup(file.toLocal8Bit());
    //link and finalize
    g_object_set(G_OBJECT(sink), "location", location, NULL);
    gst_bin_add_many(GST_BIN(pipeline), source, encoder, tagger, sink, NULL);
    gst_element_link_many(source, encoder, tagger, sink, NULL);
    return pipeline;
}

When the program is run, following messages are shown (even though the result
looks fine i.e. tags looks to be properly added to the file): -

** (<unknown>:5137): CRITICAL **: gst_adapter_take_buffer: assertion `nbytes >
0' failed

(<unknown>:5137): GStreamer-CRITICAL **: gst_buffer_set_caps: assertion
`buffer != NULL' failed

(<unknown>:5137): GStreamer-CRITICAL **: gst_pad_push: assertion
`GST_IS_BUFFER (buffer)' failed


Any idea where my code is going wrong?

Regards,

Yogesh M

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Help needed to diagnose critical error message while setting tags on flac stream

Tim-Philipp Müller-2
On Wed, 2010-04-14 at 13:55 +0530, Yogesh Marwaha wrote:

>
> I'm trying to write tags to a flac file. Here is the relevant code: -
>  (snip)
> When the program is run, following messages are shown (even though the
> result
> looks fine i.e. tags looks to be properly added to the file): -
>
> ** (<unknown>:5137): CRITICAL **: gst_adapter_take_buffer: assertion `nbytes >
> 0' failed
>
> (<unknown>:5137): GStreamer-CRITICAL **: gst_buffer_set_caps: assertion
> `buffer != NULL' failed
>
> (<unknown>:5137): GStreamer-CRITICAL **: gst_pad_push: assertion
> `GST_IS_BUFFER (buffer)' failed
>
> Any idea where my code is going wrong?

It's not your code that's wrong, it's a bug in the flactag element, as this pipeline shows:

  gst-launch-0.10 audiotestsrc ! flacenc ! flactag ! fakesink

I've filed a bug in bugzilla about this:
https://bugzilla.gnome.org/show_bug.cgi?id=615793


A few comments on your code:

>     //pipeline
>     GstElement *pipeline = gst_pipeline_new("flac-encoder");
>     //encoder
>     GstElement *encoder = gst_element_factory_make("flacenc", "flac-encoder-
> element");
>     g_object_set(G_OBJECT(encoder), "quality", mCompressionQuality, NULL);
>     //tagger
>     GstElement *tagger = gst_element_factory_make("flactag", "flac-encoder-
> tag-element");
>     GstTagSetter *tagSetter = GST_TAG_SETTER(tagger);

There's no need for the flactag element in this context. The flacenc
encoder element implements the GstTagSetter interface as well, so you
should just use that directly on flacenc. The flactag element was
written to re-tag an existing stream without re-encoding (it should work
fine of course, it just seems that no one has ever tested it after
flacenc).


>     GValue value = {0};
>     g_value_init(&value, G_TYPE_STRING);
>     g_value_set_static_string(&value, "Hello");
>     gst_tag_setter_add_tag_value(tagSetter, GST_TAG_MERGE_REPLACE, "title",
> &value);
>     g_value_unset(&value);
>     g_value_init(&value, G_TYPE_STRING);
>     g_value_set_static_string(&value, "Monty");
>     gst_tag_setter_add_tag_value(tagSetter, GST_TAG_MERGE_REPLACE, "composer",
> &value);

You could replace all that with:

  gst_tag_setter_add_tags (tagSetter, GST_TAG_MERGE_REPLACE,
      GST_TAG_TITLE, "Hello",
      GST_TAG_COMPOSER, "Monty",
      NULL);


>     gchar *location = g_strdup(file.toLocal8Bit());
>     //link and finalize
>     g_object_set(G_OBJECT(sink), "location", location, NULL);

You might be leaking the location string here if you don't do a g_free()
somewhere else.

 Cheers
  -Tim



------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Help needed to diagnose critical error message while setting tags on flac stream

Yogesh Marwaha
Thank you very much!

On 15 April 2010 04:08, Tim-Philipp Müller <[hidden email]> wrote:

>
> On Wed, 2010-04-14 at 13:55 +0530, Yogesh Marwaha wrote:
>
> >
> > I'm trying to write tags to a flac file. Here is the relevant code: -
> >  (snip)
> > When the program is run, following messages are shown (even though the
> > result
> > looks fine i.e. tags looks to be properly added to the file): -
> >
> > ** (<unknown>:5137): CRITICAL **: gst_adapter_take_buffer: assertion `nbytes >
> > 0' failed
> >
> > (<unknown>:5137): GStreamer-CRITICAL **: gst_buffer_set_caps: assertion
> > `buffer != NULL' failed
> >
> > (<unknown>:5137): GStreamer-CRITICAL **: gst_pad_push: assertion
> > `GST_IS_BUFFER (buffer)' failed
> >
> > Any idea where my code is going wrong?
>
> It's not your code that's wrong, it's a bug in the flactag element, as this pipeline shows:
>
>  gst-launch-0.10 audiotestsrc ! flacenc ! flactag ! fakesink
>
> I've filed a bug in bugzilla about this:
> https://bugzilla.gnome.org/show_bug.cgi?id=615793
>
>
> A few comments on your code:
>
> >     //pipeline
> >     GstElement *pipeline = gst_pipeline_new("flac-encoder");
> >     //encoder
> >     GstElement *encoder = gst_element_factory_make("flacenc", "flac-encoder-
> > element");
> >     g_object_set(G_OBJECT(encoder), "quality", mCompressionQuality, NULL);
> >     //tagger
> >     GstElement *tagger = gst_element_factory_make("flactag", "flac-encoder-
> > tag-element");
> >     GstTagSetter *tagSetter = GST_TAG_SETTER(tagger);
>
> There's no need for the flactag element in this context. The flacenc
> encoder element implements the GstTagSetter interface as well, so you
> should just use that directly on flacenc. The flactag element was
> written to re-tag an existing stream without re-encoding (it should work
> fine of course, it just seems that no one has ever tested it after
> flacenc).
>
>
> >     GValue value = {0};
> >     g_value_init(&value, G_TYPE_STRING);
> >     g_value_set_static_string(&value, "Hello");
> >     gst_tag_setter_add_tag_value(tagSetter, GST_TAG_MERGE_REPLACE, "title",
> > &value);
> >     g_value_unset(&value);
> >     g_value_init(&value, G_TYPE_STRING);
> >     g_value_set_static_string(&value, "Monty");
> >     gst_tag_setter_add_tag_value(tagSetter, GST_TAG_MERGE_REPLACE, "composer",
> > &value);
>
> You could replace all that with:
>
>  gst_tag_setter_add_tags (tagSetter, GST_TAG_MERGE_REPLACE,
>      GST_TAG_TITLE, "Hello",
>      GST_TAG_COMPOSER, "Monty",
>      NULL);
>
>
> >     gchar *location = g_strdup(file.toLocal8Bit());
> >     //link and finalize
> >     g_object_set(G_OBJECT(sink), "location", location, NULL);
>
> You might be leaking the location string here if you don't do a g_free()
> somewhere else.
>
>  Cheers
>  -Tim
>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



--
Yogesh M
http://sparklemedia.sourceforge.net/
http://mazedaar.wordpress.com/
http://snakeeyes.wordpress.com/

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel