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 668909 - [0.11] typefindelement is broken
[0.11] typefindelement is broken
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.11.x
Other All
: Normal major
: 0.11.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 669483 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-01-28 12:58 UTC by Matej Knopp
Modified: 2012-02-08 13:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Matej Knopp 2012-01-28 12:58:50 UTC
This patch 

http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?h=0.11&id=bf0964b63a1283eb38a6d803e7a54b07b9e9a7e5

has broken typefind. Now typefind sends SEGMENT event from loop in pull mode, which causes really bad things to demuxers. i.e. matroskademux resets current offset on new segment and the event comes while parsing is already in progress.
Comment 1 Sebastian Dröge (slomo) 2012-01-28 14:34:12 UTC
Do you have some more details or a way to reproduce it? typefind only sends a single SEGMENT event if it is driving the pipeline (i.e. the loop function is running). This shouldn't happen when matroskademux is linked to typefind, in that case matroskademux will try to activate itself in pull mode and typefind would be deactivated and only passthrough the pull_range() calls.

During my tests matroskademux was working fine
Comment 2 Matej Knopp 2012-01-28 15:05:31 UTC
Well, the pipeline is quite complex, but it starts with filesrc and decodebin2. What happens is that the typefindelement does activate its pads (stacktrace below)

The state change results in gst_type_find_element_activate_sink being called where it does a scheduling mode query and activates the pad in pull mode (starting the task). force_caps is null, which seems like the only way to prevent activation.

It is quit possible that matroska-demux works for you, it's quite racy, as the segment is send in another thread.

Stacktrace:

  • #0 gst_type_find_element_activate_sink_mode at /opt/avs-debug/_build/gstreamer/plugins/elements/gsttypefindelement.c:1134
  • #1 gst_pad_activate_mode
  • #2 gst_type_find_element_activate_sink
  • #3 gst_pad_set_active
  • #4 activate_pads at /opt/avs-debug/_build/gstreamer/gst/gstelement.c:2571
  • #5 gst_iterator_fold
  • #6 iterator_activate_fold_with_resync at /opt/avs-debug/_build/gstreamer/gst/gstelement.c:2591
  • #7 gst_element_pads_activate at /opt/avs-debug/_build/gstreamer/gst/gstelement.c:2635
  • #8 gst_element_change_state_func
  • #9 gst_type_find_element_change_state at /opt/avs-debug/_build/gstreamer/plugins/elements/gsttypefindelement.c:1222
  • #10 gst_element_change_state
  • #11 gst_element_set_state_func
  • #12 gst_element_set_state
  • #13 gst_bin_element_set_state
  • #14 gst_bin_change_state_func
  • #15 gst_decode_bin_change_state at /opt/avs-debug/_build/gst-plugins-base/gst/playback/gstdecodebin2.c:4037

Comment 3 Tim-Philipp Müller 2012-01-28 18:04:28 UTC
Maybe sticky events are not being cleared when typefind pads change scheduling mode or so?
Comment 4 Matej Knopp 2012-01-28 23:17:54 UTC
Still, should the loop even be started in the first place?
Comment 5 Tim-Philipp Müller 2012-01-28 23:30:26 UTC
> Still, should the loop even be started in the first place?

Yes, we really want to move typefinding into a streaming thread (i.e.  start up a loop), even when it's done in pull mode, instead of doing it from the application thread that does the state change.
Comment 6 Sebastian Dröge (slomo) 2012-01-30 09:19:58 UTC
Sticky events are cleared when pads are deactivated. So, do you have a simple testcase to reproduce this? :)
Comment 7 Sebastian Dröge (slomo) 2012-01-30 09:44:33 UTC
I can reproduce some problems. Seems that the typefind sinkpad is not deactivated from PULL mode when upstream wants to go in PULL mode.
Comment 8 Sebastian Dröge (slomo) 2012-02-01 09:12:07 UTC
Ok, so typefind's own loop thread should only be used if the sinkpad is activated in PULL mode and the srcpad is activated in PUSH mode. In all other cases typefind uses a different streaming thread (from upstream if PUSH/PUSH and from downstream if PULL/PULL).

This means that the loop thread must only be started if both pads are activated that way and it must be stopped again if one of the pads gets deactivated/activated in a different mode.
Comment 9 Wim Taymans 2012-02-08 13:35:45 UTC
commit 27d639ec09d6853a374d4dd8b548f2a1dbd47de6
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Wed Feb 8 14:32:01 2012 +0100

    typefind: fix race in pad mode change
    
    Fixes #668909 and presumably also #669483
Comment 10 Wim Taymans 2012-02-08 13:36:30 UTC
*** Bug 669483 has been marked as a duplicate of this bug. ***