GNOME Bugzilla – Bug 796491
gstplayer: CRITICAL assertion on duration change when playing audio files
Last modified: 2018-06-21 10:39:00 UTC
Created attachment 372534 [details] flac audio clip for test Hi, We found some duration change CRITICAL print when playing audio files. CRITICAL **: emit_duration_changed: assertion 'self->cached_duration != duration' failed Our gplay app is based on gstplayer API, this assertion is in emit_duration_changed() in gstplayer.c the cached_duration is the same as new duration. For the flac audio files (actually all the flac files on hand), when we were trying to FB ( say set rate to -1), it will report this CRITICAL warning. I had some debugging and found that in gst_base_parse_loop(): if (push_eos) { if (parse->priv->estimated_duration <= 0) { GST_ERROR("gst_base_parse_update_duration"); gst_base_parse_update_duration (parse); } ... } When change rate (need flushing),the estimated_duration here is -1 (then in gst_base_parse_update_duration() , the estimated_drift is large), so it will try to update the duration and post duration change message. However, the queried duration is the same as cached_duration, which cause this issue. I see above code is for fixing small mp3 audio duration issue (https://bugzilla.gnome.org/show_bug.cgi?id=750131) So do you have any suggestion for flac audio clips rewind CRITICAL assertion issue?
That assertion should be changed into an early return (i.e. if nothing changes, don't signal). Do you want to provide a patch for this?
Yes, that's what I can think of. If nothing changes, we don't signal I will provide a patch for this, thanks, slomo.
Created attachment 372536 [details] [review] patch for fixing duration critical assertion. Please see attachment for the patch
Review of attachment 372536 [details] [review]: ::: gst-libs/gst/player/gstplayer.c @@ +1701,2 @@ if (gst_element_query_duration (self->playbin, GST_FORMAT_TIME, &duration)) { + if (self->cached_duration != duration) There's a double-space here and in the other place before duration. Also I meant putting this comparison inside emit_duration_changed() and just doing an early return there instead of asserting :)
Created attachment 372537 [details] [review] Updated patch for fix critical warning issue
commit 92576e7db83a548fcb54e80e35758a7c10e08cf2 (HEAD -> master) Author: Lyon Wang <lyon.wang@nxp.com> Date: Mon Jun 4 16:35:41 2018 +0800 player: Fix duration-changed CRITICAL warning if duration did not actually change Check if duration is changed before emitting duration-changed signal https://bugzilla.gnome.org/show_bug.cgi?id=796491