From cd3f2fa760ba05c667d3b086cbaa3bdb0f8a584c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 1 Jun 2003 08:34:23 +0000 Subject: [PATCH] fix negotiation error handling Original commit message from CVS: fix negotiation error handling --- ext/vorbis/vorbisfile.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ext/vorbis/vorbisfile.c b/ext/vorbis/vorbisfile.c index 5322c6b290..7b17299c01 100644 --- a/ext/vorbis/vorbisfile.c +++ b/ext/vorbis/vorbisfile.c @@ -454,6 +454,8 @@ static gboolean gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link) { vorbis_info *vi = ov_info (&vorbisfile->vf, link); + GstCaps *caps; + gboolean res = TRUE; /* new logical bitstream */ vorbisfile->current_link = link; @@ -461,23 +463,26 @@ gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link) gst_vorbisfile_update_metadata (vorbisfile, link); gst_vorbisfile_update_streaminfo (vorbisfile, link); - if (gst_pad_try_set_caps (vorbisfile->srcpad, - GST_CAPS_NEW ("vorbisdec_src", - "audio/raw", - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), - "rate", GST_PROPS_INT (vi->rate), - "channels", GST_PROPS_INT (vi->channels) - )) <= 0) - { - return FALSE; + caps = GST_CAPS_NEW ("vorbisdec_src", + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (TRUE), + "width", GST_PROPS_INT (16), + "depth", GST_PROPS_INT (16), + "rate", GST_PROPS_INT (vi->rate), + "channels", GST_PROPS_INT (vi->channels)); + gst_caps_ref (caps); + + if (gst_pad_try_set_caps (vorbisfile->srcpad, caps) <= 0) { + if (!gst_pad_recover_caps_error (vorbisfile->srcpad, caps)) + res = FALSE; } - return TRUE; + gst_caps_unref (caps); + + return res; } static void @@ -565,7 +570,7 @@ gst_vorbisfile_loop (GstElement *element) /* we update the caps for each logical stream */ if (vorbisfile->vf.current_link != vorbisfile->current_link) { if (!gst_vorbisfile_new_link (vorbisfile, vorbisfile->vf.current_link)) { - gst_element_error (GST_ELEMENT (vorbisfile), "could not negotiate format"); + return; } return; }