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 759503 - Stopping a stream very soon after starting asserts
Stopping a stream very soon after starting asserts
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.6.2
Other Linux
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-15 16:07 UTC by davecraig
Modified: 2015-12-16 09:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example that provokes assert. It uses gstreamermm and boost, but is otherwise straightfoward (3.40 KB, text/plain)
2015-12-15 16:09 UTC, davecraig
  Details
Patch for plugins-bad (5.84 KB, patch)
2015-12-15 17:10 UTC, davecraig
committed Details | Review
Patch for plugins-good (6.53 KB, patch)
2015-12-15 17:10 UTC, davecraig
committed Details | Review

Description davecraig 2015-12-15 16:07:24 UTC
When I run the attached example code on my target hardware it asserts when the millisecond delay hits around 300ms. The original assert was intermittent and racey, so there's an additional change required to open up the race. In gstbaseparse.c:

   /* should have caps by now */
   if (!gst_pad_has_current_caps (parse->srcpad))
     goto no_caps;
 
+  /* Open up race.. */
+  g_usleep (100000);
 
   if (G_UNLIKELY (!parse->priv->checked_media)) {
     /* have caps; check identity */
     gst_base_parse_check_media (parse);
   }

The resulting assert is identical to the one mentioned in bug 755123 comment 11. The summary of what appears to be happening is...

Inside gst_base_parse_push_frame, it checks to see whether the srcpad has caps before carrying on. In our crash situation this test passes, but the caps have gone (because another thread has put the pad into FLUSHING mode) by further down the function when it calls gst_aac_parse_pre_push_frame. 

Although gst_pad_set_active appears to only set the pad to FLUSHING on return from gst_pad_activate_mode, pre_activate inside gst_pad_activate_mode has already set the pad to FLUSHING.
Comment 1 davecraig 2015-12-15 16:09:11 UTC
Created attachment 317434 [details]
Example that provokes assert. It uses gstreamermm and boost, but is otherwise straightfoward
Comment 2 Sebastian Dröge (slomo) 2015-12-15 16:23:39 UTC
Where exactly do you get an assertion/crash?
Comment 3 davecraig 2015-12-15 16:26:38 UTC
The crashing thread:

  • #0 raise
    at ../sysdeps/unix/sysv/linux/pt-raise.c line 36
  • #1 _g_log_abort
    at ../../glib-2.44.1/glib/gmessages.c line 315
  • #2 g_logv
    at ../../glib-2.44.1/glib/gmessages.c line 1041
  • #3 g_log
    at ../../glib-2.44.1/glib/gmessages.c line 1079
  • #4 g_return_if_fail_warning
    at ../../glib-2.44.1/glib/gmessages.c line 1088
  • #5 gst_pb_utils_add_codec_description_to_tag_list
    at ../../../../gst-plugins-base-1.6.1/gst-libs/gst/pbutils/descriptions.c line 1151
  • #6 gst_aac_parse_pre_push_frame
    at ../../../clone/gst/audioparsers/gstaacparse.c line 1374
  • #7 gst_base_parse_push_frame
    at ../../../../clone/libs/gst/base/gstbaseparse.c line 2346
  • #8 gst_base_parse_handle_and_push_frame
    at ../../../../clone/libs/gst/base/gstbaseparse.c line 2228
  • #9 gst_base_parse_finish_frame
    at ../../../../clone/libs/gst/base/gstbaseparse.c line 2559
  • #10 gst_aac_parse_handle_frame
    at ../../../clone/gst/audioparsers/gstaacparse.c line 1355
  • #11 gst_base_parse_handle_buffer
    at ../../../../clone/libs/gst/base/gstbaseparse.c line 2042
  • #12 gst_base_parse_chain
    at ../../../../clone/libs/gst/base/gstbaseparse.c line 3089
  • #13 gst_pad_chain_data_unchecked
    at ../../clone/gst/gstpad.c line 4100
  • #14 gst_pad_push_data
    at ../../clone/gst/gstpad.c line 4337
  • #15 gst_single_queue_push_one
    at ../../../clone/plugins/elements/gstmultiqueue.c line 1237
  • #16 gst_multi_queue_loop
    at ../../../clone/plugins/elements/gstmultiqueue.c line 1515
  • #17 gst_task_func
    at ../../clone/gst/gsttask.c line 331
  • #18 g_thread_pool_thread_proxy
    at ../../glib-2.44.1/glib/gthreadpool.c line 307
  • #19 g_thread_proxy
    at ../../glib-2.44.1/glib/gthread.c line 764
  • #20 start_thread
    at pthread_create.c line 339
  • #21 __thread_start
    at ../sysdeps/unix/sysv/linux/mips/clone.S line 144

Comment 4 Sebastian Dröge (slomo) 2015-12-15 16:31:29 UTC
I guess aacparse (and others) will have to check if get_current_caps() returns NULL
Comment 5 davecraig 2015-12-15 16:39:44 UTC
I had originally been comparing with gstaacparse with gstmpegaudioparse but their behaviour was the same. I see that gsth264parse has better behaviour. I'll prepare a patch which addresses as many cases of the issue as I can.
Comment 6 davecraig 2015-12-15 17:08:00 UTC
Also reference bug 737186 is the case where this was fixed for H.264.
Comment 7 davecraig 2015-12-15 17:10:26 UTC
Created attachment 317450 [details] [review]
Patch for plugins-bad
Comment 8 davecraig 2015-12-15 17:10:47 UTC
Created attachment 317451 [details] [review]
Patch for plugins-good
Comment 9 Nicolas Dufresne (ndufresne) 2015-12-15 19:15:37 UTC
Review of attachment 317450 [details] [review]:

Again ... :/ Looks good.
Comment 10 Sebastian Dröge (slomo) 2015-12-16 09:10:09 UTC
Comment on attachment 317450 [details] [review]
Patch for plugins-bad

You were leaking all the tag lists in error cases, I fixed that before merging.

commit 88d7beb921ac15893fa886647ebccf8931cccdbb
Author: Dave Craig <davecraig@unbalancedaudio.com>
Date:   Tue Dec 15 17:10:00 2015 +0000

    videoparsers: Check for NULL return value of gst_pad_get_current_caps()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759503
Comment 11 Sebastian Dröge (slomo) 2015-12-16 09:14:05 UTC
commit 328346ad210f1e64e147acac770024aa668b82e8
Author: Dave Craig <davecraig@unbalancedaudio.com>
Date:   Tue Dec 15 17:10:00 2015 +0000

    audioparsers: Check for NULL return value of gst_pad_get_current_caps()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759503
Comment 12 davecraig 2015-12-16 09:19:05 UTC
(In reply to Sebastian Dröge (slomo) from comment #10)
> Comment on attachment 317450 [details] [review] [review]
> Patch for plugins-bad
> 
> You were leaking all the tag lists in error cases, I fixed that before
> merging.
> 
Ah yes, did you fix the h264parser case too where I duplicated the fixes from?
Comment 13 davecraig 2015-12-16 09:21:10 UTC
(In reply to davecraig from comment #12)
> (In reply to Sebastian Dröge (slomo) from comment #10)
> > Comment on attachment 317450 [details] [review] [review] [review]
> > Patch for plugins-bad
> > 
> > You were leaking all the tag lists in error cases, I fixed that before
> > merging.
> > 
> Ah yes, did you fix the h264parser case too where I duplicated the fixes
> from?
Yes you did :-) Thanks!