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 688188 - videomixer: _sink_clip: GStreamer-CRITICAL **: _gst_util_uint64_scale_int: assertion `denom > 0' failed
videomixer: _sink_clip: GStreamer-CRITICAL **: _gst_util_uint64_scale_int: as...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 699952 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-12 16:59 UTC by Christian Fredrik Kalager Schaller
Modified: 2013-07-26 08:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple python test app (7.55 KB, text/x-python)
2012-11-12 16:59 UTC, Christian Fredrik Kalager Schaller
  Details
Check FPS_N to prevent zero division (1.04 KB, patch)
2013-05-01 21:17 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
Sort sticky event at insertion (1.30 KB, patch)
2013-05-04 12:33 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
Sort and warn if sticky event arrives in the wrong order. (1.49 KB, patch)
2013-05-06 15:59 UTC, Nicolas Dufresne (ndufresne)
needs-work Details | Review
[PATCH] pad: Detect, fix and warn when sticky events are in wrong order (1.55 KB, patch)
2013-05-08 01:56 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
[PATCH] pad: Only inforce STREAM_START, CAPS and SEGMENT ordering (1.26 KB, patch)
2013-05-08 22:21 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
[PATCH] pad: Improve warning message naming events type name (1.40 KB, patch)
2013-05-08 23:45 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description Christian Fredrik Kalager Schaller 2012-11-12 16:59:12 UTC
Created attachment 228794 [details]
Simple python test app

My application seems to work, but I do get this on the console.
(python:18401): GStreamer-CRITICAL **: _gst_util_uint64_scale_int: assertion `denom > 0' failed


Will attach simple python test app. Test file (to be placed in /tmp is http://www.linuxrising.org/misc/test.mkv)
Comment 1 Christian Fredrik Kalager Schaller 2012-11-12 17:02:03 UTC
(python:18464): GStreamer-CRITICAL **: _gst_util_uint64_scale_int: assertion `denom > 0' failed

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7fffecc60700 (LWP 18470)]
g_logv (log_domain=0x32a0aada98 "GStreamer", log_level=G_LOG_LEVEL_CRITICAL, format=
    0x32ac2b58fa "%s: assertion `%s' failed", args1=args1@entry=0x7fffecc5e128) at gmessages.h:101
101	void            g_logv                  (const gchar    *log_domain,
(gdb) thread apply all bt

Thread 7 (Thread 0x7fffdf7fe700 (LWP 18472))

  • #0 __strcmp_sse42
    at ../sysdeps/x86_64/multiarch/strcmp-sse42.S line 239
  • #1 orc_opcode_set_find_by_name
    from /lib64/liborc-0.4.so.0
  • #2 orc_rule_register
    from /lib64/liborc-0.4.so.0
  • #3 orc_compiler_neon_register_rules
    from /lib64/liborc-0.4.so.0
  • #4 orc_init
    from /lib64/liborc-0.4.so.0
  • #5 orc_program_new
    from /lib64/liborc-0.4.so.0
  • #6 adder_orc_add_int16
    at tmp-orc.c line 289
  • #7 gst_adder_collected
    at gstadder.c line 1217
  • #8 gst_collect_pads_check_collected
    at gstcollectpads.c line 1295
  • #9 gst_collect_pads_chain
    at gstcollectpads.c line 2009
  • #10 gst_pad_chain_data_unchecked
  • #11 gst_pad_push_data
  • #12 gst_pad_push
    at gstpad.c line 3974
  • #13 gst_proxy_pad_chain_default
    at gstghostpad.c line 128
  • #14 gst_pad_chain_data_unchecked
  • #15 gst_pad_push_data
  • #16 gst_pad_push
    at gstpad.c line 3974
  • #17 gst_proxy_pad_chain_default
    at gstghostpad.c line 128
  • #18 gst_pad_chain_data_unchecked
  • #19 gst_pad_push_data
  • #20 gst_pad_push
    at gstpad.c line 3974
  • #21 gst_audio_decoder_push_forward
    at gstaudiodecoder.c line 812
  • #22 gst_audio_decoder_output
    at gstaudiodecoder.c line 888
  • #23 gst_audio_decoder_finish_frame
    at gstaudiodecoder.c line 1111
  • #24 gst_speex_dec_parse_data
    at gstspeexdec.c line 446
  • #25 gst_speex_dec_handle_frame
    at gstspeexdec.c line 531
  • #26 gst_audio_decoder_push_buffers
    at gstaudiodecoder.c line 1256
  • #27 gst_audio_decoder_chain_forward
    at gstaudiodecoder.c line 1359
  • #28 gst_audio_decoder_chain
    at gstaudiodecoder.c line 1620
  • #29 gst_pad_chain_data_unchecked
  • #30 gst_pad_push_data
  • #31 gst_pad_push
    at gstpad.c line 3974
  • #32 gst_single_queue_push_one
    at gstmultiqueue.c line 1057
  • #33 gst_multi_queue_loop
    at gstmultiqueue.c line 1303
  • #34 gst_task_func
    at gsttask.c line 316
  • #35 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #36 g_thread_proxy
    at gthread.c line 801
  • #37 start_thread
    at pthread_create.c line 309
  • #38 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 115

Thread 6 (Thread 0x7fffdffff700 (LWP 18471))

  • #0 __lll_lock_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S line 136
  • #1 _L_lock_889
    from /lib64/libpthread.so.0
  • #2 __pthread_mutex_lock
    at pthread_mutex_lock.c line 86
  • #3 gst_collect_pads_chain
    at gstcollectpads.c line 2045
  • #4 gst_pad_chain_data_unchecked
  • #5 gst_pad_push_data
  • #6 gst_pad_push
    at gstpad.c line 3974
  • #7 gst_proxy_pad_chain_default
    at gstghostpad.c line 128
  • #8 gst_pad_chain_data_unchecked
  • #9 gst_pad_push_data
  • #10 gst_pad_push
    at gstpad.c line 3974
  • #11 gst_proxy_pad_chain_default
    at gstghostpad.c line 128
  • #12 gst_pad_chain_data_unchecked
  • #13 gst_pad_push_data
  • #14 gst_pad_push
    at gstpad.c line 3974
  • #15 gst_audio_decoder_push_forward
    at gstaudiodecoder.c line 812
  • #16 gst_audio_decoder_output
    at gstaudiodecoder.c line 888
  • #17 gst_audio_decoder_finish_frame
    at gstaudiodecoder.c line 1111
  • #18 gst_speex_dec_parse_data
    at gstspeexdec.c line 446
  • #19 gst_speex_dec_handle_frame
    at gstspeexdec.c line 531
  • #20 gst_audio_decoder_push_buffers
    at gstaudiodecoder.c line 1256
  • #21 gst_audio_decoder_chain_forward
    at gstaudiodecoder.c line 1359
  • #22 gst_audio_decoder_chain
    at gstaudiodecoder.c line 1620
  • #23 gst_pad_chain_data_unchecked
  • #24 gst_pad_push_data
  • #25 gst_pad_push
    at gstpad.c line 3974
  • #26 gst_single_queue_push_one
    at gstmultiqueue.c line 1057
  • #27 gst_multi_queue_loop
    at gstmultiqueue.c line 1303
  • #28 gst_task_func
    at gsttask.c line 316
  • #29 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #30 g_thread_proxy
    at gthread.c line 801
  • #31 start_thread
    at pthread_create.c line 309
  • #32 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 115

Thread 5 (Thread 0x7fffecc60700 (LWP 18470))

  • #0 g_logv
    at gmessages.h line 101
  • #1 g_log
    at gmessages.c line 792
  • #2 g_return_if_fail_warning
    at gmessages.c line 801
  • #3 _gst_util_uint64_scale_int
    at gstutils.c line 586
  • #4 gst_videomixer2_sink_clip
    at videomixer2.c line 1624
  • #5 gst_collect_pads_clip_time
    at gstcollectpads.c line 1573
  • #6 gst_collect_pads_event_default
    at gstcollectpads.c line 1709
  • #7 gst_videomixer2_sink_event
    at videomixer2.c line 1708
  • #8 gst_collect_pads_event
    at gstcollectpads.c line 1809
  • #9 gst_pad_send_event_unchecked
    at gstpad.c line 4821
  • #10 gst_pad_push_event_unchecked
    at gstpad.c line 4514
  • #11 push_sticky
    at gstpad.c line 3285
  • #12 events_foreach
    at gstpad.c line 514
  • #13 check_sticky
    at gstpad.c line 3333
  • #14 gst_pad_push_event
    at gstpad.c line 4635
  • #15 gst_base_transform_sink_eventfunc
    at gstbasetransform.c line 1845
  • #16 gst_pad_send_event_unchecked
    at gstpad.c line 4821
  • #17 gst_pad_push_event_unchecked
    at gstpad.c line 4514
  • #18 push_sticky
    at gstpad.c line 3285
  • #19 events_foreach
    at gstpad.c line 514
  • #20 check_sticky
    at gstpad.c line 3333
  • #21 gst_pad_push_event
    at gstpad.c line 4635
  • #22 event_forward_func
    at gstpad.c line 2719
  • #23 gst_pad_forward
    at gstpad.c line 2673
  • #24 gst_pad_event_default
    at gstpad.c line 2770
  • #25 gst_pad_send_event_unchecked
    at gstpad.c line 4821
  • #26 gst_pad_push_event_unchecked
    at gstpad.c line 4514
  • #27 push_sticky
    at gstpad.c line 3285
  • #28 events_foreach
    at gstpad.c line 514
  • #29 check_sticky
    at gstpad.c line 3333
  • #30 gst_pad_push_event
    at gstpad.c line 4635
  • #31 event_forward_func
    at gstpad.c line 2719
  • #32 gst_pad_forward
    at gstpad.c line 2673
  • #33 gst_pad_event_default
    at gstpad.c line 2770
  • #34 gst_pad_send_event_unchecked
    at gstpad.c line 4821
  • #35 gst_pad_push_event_unchecked
    at gstpad.c line 4514
  • #36 push_sticky
    at gstpad.c line 3285
  • #37 events_foreach
    at gstpad.c line 514
  • #38 check_sticky
    at gstpad.c line 3333
  • #39 gst_pad_push_event
    at gstpad.c line 4635
  • #40 gst_pad_set_caps
    at /usr/include/gstreamer-1.0/gst/gstcompat.h line 71
  • #41 gst_video_decoder_negotiate_default
    at gstvideodecoder.c line 2935
  • #42 gst_video_decoder_negotiate
    at gstvideodecoder.c line 3022
  • #43 theora_handle_type_packet
    at gsttheoradec.c line 508
  • #44 theora_handle_header_packet
    at gsttheoradec.c line 539
  • #45 theora_dec_decode_buffer
    at gsttheoradec.c line 788
  • #46 theora_dec_handle_frame
    at gsttheoradec.c line 812
  • #47 gst_video_decoder_decode_frame
    at gstvideodecoder.c line 2665
  • #48 gst_video_decoder_have_frame
    at gstvideodecoder.c line 2602
  • #49 gst_video_decoder_chain_forward
    at gstvideodecoder.c line 1713
  • #50 gst_video_decoder_chain
    at gstvideodecoder.c line 1957
  • #51 gst_pad_chain_data_unchecked
  • #52 gst_pad_push_data
  • #53 gst_pad_push
    at gstpad.c line 3974
  • #54 gst_single_queue_push_one
    at gstmultiqueue.c line 1057
  • #55 gst_multi_queue_loop
    at gstmultiqueue.c line 1303
  • #56 gst_task_func
    at gsttask.c line 316
  • #57 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #58 g_thread_proxy
    at gthread.c line 801
  • #59 start_thread
    at pthread_create.c line 309
  • #60 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 115

Thread 4 (Thread 0x7fffed461700 (LWP 18469))

  • #0 lookup_type_node_I
    at gtype.c line 400
  • #1 g_type_is_a
    at gtype.c line 3502
  • #2 g_type_check_value_holds
    at gtype.c line 4147
  • #3 gst_value_intersect
    at gstvalue.c line 4560
  • #4 gst_value_intersect_list
    at gstvalue.c line 3489
  • #5 gst_value_intersect_list
    at gstvalue.c line 3489
  • #6 gst_structure_intersect_field1
    at gststructure.c line 3019
  • #7 gst_structure_foreach
    at gststructure.c line 1116
  • #8 gst_structure_intersect
    at gststructure.c line 3066
  • #9 gst_caps_intersect_first
    at gstcaps.c line 1268
  • #10 gst_caps_intersect_full
    at gstcaps.c line 1298
  • #11 gst_base_transform_query_caps
    at gstbasetransform.c line 706
  • #12 gst_base_transform_default_query
    at gstbasetransform.c line 1487
  • #13 gst_pad_query
    at gstpad.c line 3418
  • #14 gst_pad_query_caps
    at gstutils.c line 2751
  • #15 gst_base_transform_acceptcaps_default
    at gstbasetransform.c line 1242
  • #16 gst_base_transform_default_query
    at gstbasetransform.c line 1475
  • #17 gst_pad_query
    at gstpad.c line 3418
  • #18 gst_pad_peer_query
    at gstpad.c line 3549
  • #19 query_accept_caps_func
    at gstutils.c line 2411
  • #20 gst_pad_forward
    at gstpad.c line 2673
  • #21 gst_pad_proxy_query_accept_caps
    at gstutils.c line 2450
  • #22 gst_pad_query_accept_caps_default
    at gstpad.c line 2799
  • #23 gst_pad_query_default
    at gstpad.c line 2944
  • #24 gst_pad_query
    at gstpad.c line 3418
  • #25 gst_pad_peer_query
    at gstpad.c line 3549
  • #26 query_accept_caps_func
    at gstutils.c line 2411
  • #27 gst_pad_forward
    at gstpad.c line 2673
  • #28 gst_pad_proxy_query_accept_caps
    at gstutils.c line 2450
  • #29 gst_pad_query_accept_caps_default
    at gstpad.c line 2799
  • #30 gst_pad_query_default
    at gstpad.c line 2944
  • #31 gst_pad_query
    at gstpad.c line 3418
  • #32 gst_pad_query_accept_caps
    at gstutils.c line 2834
  • #33 pre_eventfunc_check
    at gstpad.c line 4700
  • #34 gst_pad_send_event_unchecked
    at gstpad.c line 4814
  • #35 gst_pad_push_event_unchecked
    at gstpad.c line 4514
  • #36 push_sticky
    at gstpad.c line 3285
  • #37 events_foreach
    at gstpad.c line 514
  • #38 check_sticky
    at gstpad.c line 3333
  • #39 gst_pad_push_event
    at gstpad.c line 4635
  • #40 gst_pad_set_caps
    at /usr/include/gstreamer-1.0/gst/gstcompat.h line 71
  • #41 gst_video_decoder_negotiate_default
    at gstvideodecoder.c line 2935
  • #42 gst_video_decoder_negotiate
    at gstvideodecoder.c line 3022
  • #43 gst_video_decoder_finish_frame
    at gstvideodecoder.c line 2366
  • #44 gst_video_decoder_decode_frame
    at gstvideodecoder.c line 2665
  • #45 gst_video_decoder_have_frame
    at gstvideodecoder.c line 2602
  • #46 gst_video_decoder_chain_forward
    at gstvideodecoder.c line 1713
  • #47 gst_video_decoder_chain
    at gstvideodecoder.c line 1957
  • #48 gst_pad_chain_data_unchecked
  • #49 gst_pad_push_data
  • #50 gst_pad_push
    at gstpad.c line 3974
  • #51 gst_single_queue_push_one
    at gstmultiqueue.c line 1057
  • #52 gst_multi_queue_loop
    at gstmultiqueue.c line 1303
  • #53 gst_task_func
    at gsttask.c line 316
  • #54 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #55 g_thread_proxy
    at gthread.c line 801
  • #56 start_thread
    at pthread_create.c line 309
  • #57 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 115

Comment 2 Michael Rubinstein 2013-01-01 16:05:22 UTC
I see the same issue.

My environment:
OS:  Windows/mingw.
App: Custom, 'C'.
GST: 1.0.4 (also occurred in 1.0.3)

It only happens once at startup.  It doesn't seem to cause any problem besides the message.
Comment 3 Nicolas Dufresne (ndufresne) 2013-05-01 20:26:01 UTC
(In reply to comment #0)
> Created an attachment (id=228794) [details]
Unrelated comment, it's GLib.MainLoop instead of GObject.MainLoop.
Comment 4 Nicolas Dufresne (ndufresne) 2013-05-01 21:17:04 UTC
Created attachment 243010 [details] [review]
Check FPS_N to prevent zero division

This fails when called from a segment event with a fake buffer that has no duration. We need to check FPS_N since on the first segment event there is no caps in the videomixer, and even on second event, we can still have dynamic framerate (0/1).

I'm basing this patch on the fact that we assert but that the application still works properly.
Comment 5 Sebastian Dröge (slomo) 2013-05-02 07:26:57 UTC
Why would a segment arrive *before* a caps event? That must not happen
Comment 6 Michael Rubinstein 2013-05-02 15:25:25 UTC
In my case the caps come first.  However, the h.264 parser/decoder delivers 0/1 for the framerate.  Maybe this means "variable framerate".  My content is a mixture of 24000/1001 and 30000/1001 fps.

I'm using "h264parse" and "avdec_h264".
Comment 7 Nicolas Dufresne (ndufresne) 2013-05-02 15:54:17 UTC
(In reply to comment #5)
> Why would a segment arrive *before* a caps event? That must not happen

Oh, then I got it wrong, so it's caps event -> segment -> buffers ? In any case, we need to check that the numerator is not 0, since it mean dynamic framerate as exposed by Michael Rubinstein. Or maybe not having a duration while framerate is dynamic is consider invalid ?

As a step back, isn't it abusing the API to create fake buffers for the purpose of calling clip ? I feel like this virtual method should have been changed in 1.0, could it be ?
Comment 8 Mathieu Duponchelle 2013-05-02 16:29:54 UTC
Review of attachment 243010 [details] [review]:

Technically, what should be checked here is the denominator. Also the root of the problem in my opinion is that caps should have been negotiated here, providing a supposedly non-zero denominator and numerator.
Comment 9 Sebastian Dröge (slomo) 2013-05-02 16:34:31 UTC
(In reply to comment #7)
> (In reply to comment #5)
> > Why would a segment arrive *before* a caps event? That must not happen
> 
> Oh, then I got it wrong, so it's caps event -> segment -> buffers ?

Yes, and before caps comes stream-start. See the order of events in gstevent.h

> In any
> case, we need to check that the numerator is not 0, since it mean dynamic
> framerate as exposed by Michael Rubinstein. Or maybe not having a duration
> while framerate is dynamic is consider invalid ?

Dynamic framerate must have timestamps but not duration.

> As a step back, isn't it abusing the API to create fake buffers for the purpose
> of calling clip ? I feel like this virtual method should have been changed in
> 1.0, could it be ?

Yes, there should be no real need for fake buffers.
Comment 10 Tim-Philipp Müller 2013-05-02 16:45:13 UTC
(In reply to comment #8)
> Review of attachment 243010 [details] [review]:
> 
> Technically, what should be checked here is the denominator. Also the root of
> the problem in my opinion is that caps should have been negotiated here,
> providing a supposedly non-zero denominator and numerator.

Almost :) 0/1 is a valid framerate and stands for 'variable framerate'. We do need to check the numerator here, because that's the denominator in the next line, the one that causes the criticals.
Comment 11 Michael Rubinstein 2013-05-02 16:48:15 UTC
I think my earlier comment was wrong.

I set a breakpoint on the caps handling code, verified that it got hit and waited for the assert.

However, the breakpoint was hit for a different sink that the one at the assert.

The pad info at the assert:
info = {
  finfo = 0x0,
  interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE,
  flags = GST_VIDEO_FLAG_NONE,
  width = 0,
  height = 0,
  size = 0,
  views = 0,
  chroma_site = GST_VIDEO_CHROMA_SITE_UNKNOWN,
  colorimetry = {
    range = GST_VIDEO_COLOR_RANGE_UNKNOWN,
    matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN,
    transfer = GST_VIDEO_TRANSFER_UNKNOWN,
    primaries = GST_VIDEO_COLOR_PRIMARIES_UNKNOWN
  },
  par_n = 0,
  par_d = 0,
  fps_n = 0,
  fps_d = 0,
  offset = {0, 1072693248, 0, 1072693248},
  stride = {3, 0, 0, 0},
  _gst_reserved = {0x0, 0x0, 0x0, 0x0}
},
xpos = -1,
ypos = -1,
zorder = 0,
alpha = 0,
mixcol = 0xffffffff


The buffer:

0 = {
mini_object = {
  type = 36251888,
  refcount = 1,
  lockstate = 0,
  flags = 0,
  copy = 0x6144f3a4 <_gst_buffer_copy>,
  dispose = 0x6144dbc0 <_gst_buffer_dispose>,
  free = 0x6144da2c <_gst_buffer_free>,
  n_qdata = 0,
  qdata = 0x0
},
pool = 0x0,
pts = 0,
dts = 18446744073709551615,
duration = 18446744073709551615,
offset = 18446744073709551615,
offset_end = 18446744073709551615
Comment 12 Mathieu Duponchelle 2013-05-02 21:04:30 UTC
(In reply to comment #8)
> Review of attachment 243010 [details] [review]:
> 
> Technically, what should be checked here is the denominator.

Didn't read the code closely enough, I thought denominator was passed as the denominator sorry.

> Also the root of
> the problem in my opinion is that caps should have been negotiated here,
> providing a supposedly non-zero denominator and numerator.

We have a similar problem in GES, when trying to render a ogv from two ogvs with a transition, oggdemux produces a segment with start equal to 0 and stop equal to the duration of the file source, where matroskademux doesn't have the same behaviour. I don't know what the correct behaviour is, but I think that segment ought not to be emitted in these circumstances.
Comment 13 Nicolas Dufresne (ndufresne) 2013-05-03 14:09:00 UTC
I had a little brainstorm with ocrete yesterday, and we had that impression that there exist valid cases where event will not stick on the pads in the proper order (segment before caps). It would be nice to try and see if sorting sticky at insertion helps in this case.
Comment 14 Nicolas Dufresne (ndufresne) 2013-05-04 12:33:21 UTC
Created attachment 243285 [details] [review]
Sort sticky event at insertion

Assuming there is legit use cases where there might not be caps, but a segment (e.g. like a BYTE segment), it might be preferrable to simply sort sticky at insertion, so when it's time to let them go, they are in the right order.
Comment 15 Sebastian Dröge (slomo) 2013-05-06 13:26:33 UTC
While this patch look correct it only works around the original problem that something is sending events in the wrong order. Do you know what is sending events in the wrong order here and why?
Comment 16 Nicolas Dufresne (ndufresne) 2013-05-06 13:42:39 UTC
I honestly did not put time yet at figuring exactly what is going on. My hypothesis was that a byte segment stick somewhere before the type finding is completed, breaking the very stricked order that shall be respected. This scenario seemed plausible, and not really a bug.

Clearly, it does not cost anything to sort the sticky, but if we don't, we should probably add some code to detect miss-ordering. Miss-ordering happens when insertion point with that new code is not the length of the array (the end). But this is still quite late detection, getting a warning if a segment stick without caps would be better (if it is invalid in all cases like byte segment).
Comment 17 Sebastian Dröge (slomo) 2013-05-06 14:17:55 UTC
<stormer> slomo: I was wondering if it was plausible to get a segment without caps during the type finding ? like a byte segment
<slomo> stormer: yes, like for filesrc you never get caps
<slomo> stormer: but typefind should first forward caps, then segment
<slomo> stormer: and filesrc should never push caps after a segment
<stormer> slomo: we'll have to check that, never the less, we need code to catch this, because the way it is done right now, it is really easy to break the order, and the effect is visible much later, after the fact
<slomo> stormer: i'm fine with a check in gstpad that causes a g_warning() if events happen out of order
<slomo> stormer: but silently fixing that up is just covering bugs elsewhere
<stormer> possibly, as said my filling was that there is cases where a segment will stick, and (without flush) will get replaced by a pair of caps and segment, but that leads to miss-ordering
<stormer> s/filling/feeling/
<stormer> slomo: it's also difficult to control when you try to do dynamic linking
<slomo> stormer: do you have a scenario where that could happen but all elements are doing their job correctly?
<__tim> if I'm not mistaken you only wrote that you and ocrete "had a feeling" it could happen legitimately, but you didn't provide more details :)
<stormer> slomo: that's what I said, it takes hours to analyse what going on, when I'll have to revisit, I just thought that one of you knew if such a scenario exist or not
<__tim> when you link the sticky events should be dispatched in the right order (and a predefined order) - is that not 
<slomo> stormer: i can't think of any, sorry :) but feel free to push a change similar to your latest, that doesn't force the order but instead does a g_warning()
Comment 18 Nicolas Dufresne (ndufresne) 2013-05-06 15:44:17 UTC
Ok, I've been experimenting with traces. Non-related finding is that oggmux always sends it's segment beofre the caps (See bug #699763). This floods a little bit while trying to find this issue.

By adding segment and caps specific check, I managed to detect the right moment a miss-ordering is produced. I'm out of time for today, but I have found that the miss-ordering happens when cached events get sent in gst_video_decoder_prepare_finish_frame() (this is the video decoder base class). To be continued ...
Comment 19 Nicolas Dufresne (ndufresne) 2013-05-06 15:59:02 UTC
Created attachment 243398 [details] [review]
Sort and warn if sticky event arrives in the wrong order.

I've just replaced the patch with one that is not silent. Also, for the posterity:

<ocrete> __tim: slomo: the use-case for caps-after-segment is ... if you have filesrc ! capsfilter ! ... ... and you manually set the caps once it's playing
<slomo> ocrete: is there any good reason to do that? but yes, then it happens :)
<ocrete> slomo: can't think of any, but I'm pretty sure it's just a matter of time before it happens
Comment 20 Sebastian Dröge (slomo) 2013-05-07 07:20:03 UTC
Review of attachment 243398 [details] [review]:

::: gst/gstpad.c
@@ +4437,3 @@
+
+    if (type < GST_EVENT_TYPE (ev->event)) {
+      GST_WARNING_OBJECT (pad, "Sticky event miss-ordering detected");

Make this a g_warning() that also includes the name of the pad and parent (GST_DEBUG_PAD_NAME). And isn't it mis-ordering with one 's'? :)
Comment 21 Nicolas Dufresne (ndufresne) 2013-05-08 01:56:39 UTC
Created attachment 243556 [details] [review]
[PATCH] pad: Detect, fix and warn when sticky events are in wrong order


We can prevent buggy element from causing other elements to fail or crash
by sorting sticky event at insertion. In this case, we also warn as this
is not supposed to happen.

See: https://bugzilla.gnome.org/show_bug.cgi?id=688188
---
 gst/gstpad.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
Comment 22 Sebastian Dröge (slomo) 2013-05-08 11:50:02 UTC
Comment on attachment 243556 [details] [review]
[PATCH] pad: Detect, fix and warn when sticky events are in wrong order

commit a68e33712eeb9104a418a0882725ac2290f29a51
Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Date:   Tue May 7 21:53:37 2013 -0400

    pad: Detect, fix and warn when sticky events are in wrong order
    
    We can prevent buggy element from causing other elements to fail or crash
    by sorting sticky event at insertion. In this case, we also warn as this
    is not supposed to happen.
    
    See: https://bugzilla.gnome.org/show_bug.cgi?id=688188
Comment 23 Nicolas Dufresne (ndufresne) 2013-05-08 21:56:34 UTC
*** Bug 699952 has been marked as a duplicate of this bug. ***
Comment 24 Nicolas Dufresne (ndufresne) 2013-05-08 21:57:02 UTC
The new warning I have introduced is a little too agressive. TAG, BUFFERSIZE,
SINK_MESSAGE, and TOC have no order restriction. If that is fine, I would keep
inserting these sorted, and then warn if the event type we are inserting is
before an event type smaller then SEGMENT event.
Comment 25 Nicolas Dufresne (ndufresne) 2013-05-08 22:21:22 UTC
Created attachment 243635 [details] [review]
[PATCH] pad: Only inforce STREAM_START, CAPS and SEGMENT ordering


Previous patch was inforcing a complete ordering of the sticky events, while
in fact, only STREAM_START, CAPS and SEGMENT events need proper ordering.

See: https://bugzilla.gnome.org/show_bug.cgi?id=688188
---
 gst/gstpad.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Comment 26 Nicolas Dufresne (ndufresne) 2013-05-08 23:45:33 UTC
Created attachment 243645 [details] [review]
[PATCH] pad: Improve warning message naming events type name


With this patch, message should look like ¨Sticky event misordering, got
'caps' before 'stream-start'¨ making it faster to debug.

https://bugzilla.gnome.org/show_bug.cgi?id=688188
---
 gst/gstpad.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Comment 27 Sebastian Dröge (slomo) 2013-07-10 07:56:53 UTC
Any news on this? Is still something missing here?
Comment 28 Nicolas Dufresne (ndufresne) 2013-07-10 18:06:38 UTC
Would have to test, but I think the only remaining is the case where we have a 0/1 fps.
Comment 29 Mathieu Duponchelle 2013-07-10 18:42:51 UTC
This bug doesn't appear in our test cases anymore, and with Nicolas' patch I can't see it happening again anytime soon :)
Comment 30 Sebastian Dröge (slomo) 2013-07-11 08:04:42 UTC
I fixed some 0/1 fps issues yesterday in videomixer.
Comment 31 Sebastian Dröge (slomo) 2013-07-26 08:09:27 UTC
So let's get rid of it?