After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692784 - typefind element pushes caps event before stream_start
typefind element pushes caps event before stream_start
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.0.5
Other Linux
: Normal normal
: 1.1.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-01-29 11:03 UTC by Paul HENRYS
Modified: 2013-04-29 11:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1.77 KB, patch)
2013-01-29 11:04 UTC, Paul HENRYS
needs-work Details | Review

Description Paul HENRYS 2013-01-29 11:03:09 UTC
When typefind element is in MODE_TYPEFIND mode and it receives a CAPS event, it first pushes the CAPS event on its src pad and then calls gst_type_find_element_setcaps() which calls gst_type_find_element_send_cached_events().

This leads to push CAPS event before STREAM_START event which should be sent before any other serialized event.

In the patch provided, it calls gst_type_find_element_send_cached_events() before pushing the caps event and not in gst_type_find_element_setcaps() anymore.

Cheers,

Paul HENRYS
Comment 1 Paul HENRYS 2013-01-29 11:04:19 UTC
Created attachment 234713 [details] [review]
Patch
Comment 2 Sebastian Dröge (slomo) 2013-01-31 10:50:07 UTC
Review of attachment 234713 [details] [review]:

This is not entirely correct. typefind might receive other events (e.g. TAG events) from upstream after the STREAM_START event and before it knows the caps. You must ensure that the order of events is still correct in the end: STREAM_START, CAPS, SEGMENT, (TAGS, SINK_MESSAGE, TOC)*, EOS
Comment 3 Tim-Philipp Müller 2013-04-27 18:46:42 UTC
Still an issue in git:

$ gst-launch-1.0 appsrc caps=foo/x-bar ! typefind ! fakesink silent=false -v | grep fakesink0
event   ******* (fakesink0:sink) E (type: caps (12814), GstEventCaps, caps=(GstCaps)foo/x-bar;) 0x1b80700
fakesink0.GstPad:sink: caps = foo/x-bar
event   ******* (fakesink0:sink) E (type: caps (12814), GstEventCaps, caps=(GstCaps)foo/x-bar;) 0x1b80760
fakesink0.GstPad:sink: caps = foo/x-bar
event   ******* (fakesink0:sink) E (type: stream-start (10254), GstEventStreamStart, stream-id=(string)0b57dec7d8e65bc91f84f841c55c227a, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE;) 0x1b806a0

typefind also seems to duplicate the caps event.
Comment 4 Sebastian Dröge (slomo) 2013-04-29 11:22:55 UTC
commit dec149ee6d0cdcc64572d0fc0c54bd0b2567e7cf
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 13:20:11 2013 +0200

    typefind: Always leave TYPEFIND mode when we're stopping typefinding

commit def227759b4ffc3e80235e7c046192456b6a9164
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 13:03:24 2013 +0200

    typefind: Simplify code
    
    This is only called when in TYPEFIND mode.

commit e807e17f0979b42e2979c4827e89375b55454bdb
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:58:07 2013 +0200

    typefind: Push pending events independent of the existence of a downstream chain function and peer
    
    Downstream might create a peer only as result of the events in theory.

commit d4323634b302f7e08b0fb15d7215e3b444dc7363
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:56:54 2013 +0200

    typefind: Only push CAPS event once if we get one from upstream
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692784

commit 118a720e4190841f713f34c84ba8c116c3d51998
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:54:27 2013 +0200

    typefind: Stop typefinding if we get a CAPS event from upstream

commit f3412c7ccc58d37139bbceb3050d578d23b9683b
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:52:46 2013 +0200

    typefind: Improve handling of GAP events
    
    There's still room for improvement though.

commit f2fb2ced431fa94c08283b25a2fefafb371d09f3
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:48:29 2013 +0200

    typefind: Forward events that should happen before the caps event directly
    
    There's no point in storing them and sending them later, and doing so would
    later require to distinguish between events that should come before caps and
    after.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692784

commit 5945c5435d133075cbe317f6b9d4e80adcbae2ff
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:48:13 2013 +0200

    typefind: Only push pending buffers and events if we have caps

commit da358ad62277422c9699c3064dc4a6b42fbd13ff
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Mon Apr 29 12:39:20 2013 +0200

    typefind: Remove code that would cause caps to be sent twice
    
    Whenever we set typefind->caps we will also send a caps event downstream.