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 776999 - queue2: Avoid return flushing for a not-linked state
queue2: Avoid return flushing for a not-linked state
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 1.11.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-08 09:21 UTC by Seungha Yang
Modified: 2017-03-17 04:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
adaptivedemux: Restart streaming even if last flow was FLUSHING (1.22 KB, patch)
2017-01-08 09:21 UTC, Seungha Yang
rejected Details | Review
Reproduced log (2.23 MB, application/x-7z-compressed)
2017-01-22 05:49 UTC, Seungha Yang
  Details
patch for print log (1.97 KB, patch)
2017-01-22 05:50 UTC, Seungha Yang
rejected Details | Review
queue2: avoid return flushing if we have a not-linked (2.47 KB, patch)
2017-01-22 15:03 UTC, Thiago Sousa Santos
committed Details | Review
queue: avoid return flushing if we have a not-linked (1.49 KB, patch)
2017-03-15 05:20 UTC, Thiago Sousa Santos
committed Details | Review
qtmux: Join chunks together if they have the same size (4.62 KB, patch)
2017-03-16 05:26 UTC, Thiago Sousa Santos
rejected Details | Review

Description Seungha Yang 2017-01-08 09:21:16 UTC
Queue2 element might return FLUSHING although it's not-linked condition.
This frequently happened with track switching in case of playbin3 pipeline.
Comment 1 Seungha Yang 2017-01-08 09:21:56 UTC
Created attachment 343111 [details] [review]
adaptivedemux: Restart streaming even if last flow was FLUSHING
Comment 2 Olivier Crête 2017-01-11 18:18:20 UTC
This sounds like a bug in queue2 instead of adaptivedemux?
Comment 3 Seungha Yang 2017-01-12 00:32:44 UTC
(In reply to Olivier Crête from comment #2)
> This sounds like a bug in queue2 instead of adaptivedemux?

It might be bug of queue2, but I'm not sure it's really bug.
I suspect following code causes return FLUSHING
https://cgit.freedesktop.org/gstreamer/gstreamer/tree/plugins/elements/gstqueue2.c#n2558
Comment 4 Thiago Sousa Santos 2017-01-21 21:26:45 UTC
Do you have a test application to reproduce this issue? Or how do you reproduce it manually?
Comment 5 Thiago Sousa Santos 2017-01-21 21:48:20 UTC
Another option is providing GST_DEBUG=6 logs of the issue.
Comment 6 Seungha Yang 2017-01-22 05:49:59 UTC
Created attachment 343974 [details]
Reproduced log
Comment 7 Seungha Yang 2017-01-22 05:50:31 UTC
Created attachment 343975 [details] [review]
patch for print log
Comment 8 Seungha Yang 2017-01-22 05:54:23 UTC
(In reply to Thiago Sousa Santos from comment #5)
> Another option is providing GST_DEBUG=6 logs of the issue.

Please refer to attached log file.

To reproduce this issue, I applied a patch for supporting playbin3 track-change by gst-play
https://bugzilla.gnome.org/show_bug.cgi?id=775469

On playbin3, reproducing sequence is, repeated audio track change by press 'a' on playbin3.
Test mpd :
http://dash.akamaized.net/dash264/TestCases/10a/1/iis_forest_short_poem_multi_lang_480p_single_adapt_aaclc_sidx.mpd
Comment 9 Thiago Sousa Santos 2017-01-22 13:27:55 UTC
(In reply to Seungha Yang from comment #3)
> (In reply to Olivier Crête from comment #2)
> > This sounds like a bug in queue2 instead of adaptivedemux?
> 
> It might be bug of queue2, but I'm not sure it's really bug.
> I suspect following code causes return FLUSHING
> https://cgit.freedesktop.org/gstreamer/gstreamer/tree/plugins/elements/
> gstqueue2.c#n2558

Indeed this seems to be the issue. queue2 is returning flushing when it should be not-linked
Comment 10 Thiago Sousa Santos 2017-01-22 15:03:11 UTC
Created attachment 343980 [details] [review]
queue2: avoid return flushing if we have a not-linked

This could fix it. Though I'm not sure returning not-linked for
events is the right thing to do. Maybe we can enqueue them and
return GST_FLOW_OK and leave the GST_FLOW_NOT_LINKED returned
for when buffers are pushed, like queue does.

What do you think?
Comment 11 Seungha Yang 2017-01-22 22:59:40 UTC
(In reply to Thiago Sousa Santos from comment #10)
> Created attachment 343980 [details] [review] [review]
> This could fix it. Though I'm not sure returning not-linked for
> events is the right thing to do. Maybe we can enqueue them and
> return GST_FLOW_OK and leave the GST_FLOW_NOT_LINKED returned
> for when buffers are pushed, like queue does.
> 
> What do you think?

I think it looks good, but I'd like to reason Tim-Philipp Müller's opinion. because queue2's this behaviour can be related to following bug
https://bugzilla.gnome.org/show_bug.cgi?id=777009
Comment 12 Sebastian Dröge (slomo) 2017-01-31 11:21:37 UTC
Comment on attachment 343980 [details] [review]
queue2: avoid return flushing if we have a not-linked

This seems correct (same thing for queue and multiqueue please when merging)
Comment 13 Sebastian Dröge (slomo) 2017-01-31 11:22:35 UTC
Comment on attachment 343111 [details] [review]
adaptivedemux: Restart streaming even if last flow was FLUSHING

This seems to fix it at the wrong place
Comment 14 Seungha Yang 2017-03-05 23:46:06 UTC
(In reply to Sebastian Dröge (slomo) from comment #12)
> Comment on attachment 343980 [details] [review] [review]
> queue2: avoid return flushing if we have a not-linked
> 
> This seems correct (same thing for queue and multiqueue please when merging)

This queue2 modification works well for me. Could we merge this patch?
Comment 15 Sebastian Dröge (slomo) 2017-03-06 08:10:39 UTC
The same change also should be done for queue and multiqueue. And if we don't do it now when merging the queue2 part, we will just forget :)

Want to provide a patch for those? It's the same logic
Comment 16 Thiago Sousa Santos 2017-03-12 16:56:51 UTC
Hi Seungha, are you working on porting the logic? Let me know if that is the case or I could do it this week and merge both patches.
Comment 17 Seungha Yang 2017-03-12 22:58:45 UTC
(In reply to Thiago Sousa Santos from comment #16)
> Hi Seungha, are you working on porting the logic? Let me know if that is the
> case or I could do it this week and merge both patches.

I didn't work for it now.. Could you please porting that on queue/multiqueue? :)
Comment 18 Thiago Sousa Santos 2017-03-15 05:20:07 UTC
Created attachment 347982 [details] [review]
queue: avoid return flushing if we have a not-linked

Return the correct flow return instead of returning always flushing.
This would cause queue to convert not-linked to flushing and making
upstream elements stop.

Based on the previous patch for queue2.
Comment 19 Thiago Sousa Santos 2017-03-15 05:20:23 UTC
multiqueue doesn't have the issue.
Comment 20 Sebastian Dröge (slomo) 2017-03-15 08:10:14 UTC
Comment on attachment 347982 [details] [review]
queue: avoid return flushing if we have a not-linked

Just wondering, shouldn't this still convert any queue->srcresult == GST_FLOW_OK to GST_FLOW_FLUSHING here, and only pass through the other ones?
Comment 21 Thiago Sousa Santos 2017-03-16 05:26:39 UTC
Created attachment 348061 [details] [review]
qtmux: Join chunks together if they have the same size

This is the piece of the original patch that fixes it for 1.10.

Should I push this or the original version?
Comment 22 Thiago Sousa Santos 2017-03-16 05:28:15 UTC
Comment on attachment 348061 [details] [review]
qtmux: Join chunks together if they have the same size

Sorry, wrong bug number.
Comment 23 Thiago Sousa Santos 2017-03-16 05:41:47 UTC
(In reply to Sebastian Dröge (slomo) from comment #20)
> Comment on attachment 347982 [details] [review] [review]
> queue: avoid return flushing if we have a not-linked
> 
> Just wondering, shouldn't this still convert any queue->srcresult ==
> GST_FLOW_OK to GST_FLOW_FLUSHING here, and only pass through the other ones?

If I understand your question correctly. The QUEUE_MUTEX_LOCK_CHECK checks for GST_FLOW_OK and only jumps into the label if it isn't in OK. So it can only reach that code if it isn't with q OK result so far.
Comment 24 Sebastian Dröge (slomo) 2017-03-16 05:46:15 UTC
Indeed, sorry for the confusion
Comment 25 Thiago Sousa Santos 2017-03-17 04:52:10 UTC
commit 058bdcfe6b6ae4c1ceb8c31560d2a9bffe075e1d
Author: Thiago Santos <thiagossantos@gmail.com>
Date:   Tue Mar 14 22:18:36 2017 -0700

    queue: avoid return flushing if we have a not-linked
    
    Return the correct flow return instead of returning always flushing.
    This would cause queue to convert not-linked to flushing and making
    upstream elements stop.
    
    Based on the previous patch for queue2.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776999

commit 045700e80ed3c5bb9c5af04a8dfa9d0210d05fe3
Author: Thiago Santos <thiagossantos@gmail.com>
Date:   Sun Jan 22 11:26:56 2017 -0300

    queue2: avoid return flushing if we have a not-linked
    
    Return the correct flow return instead of returning always flushing.
    This would cause queue2 to convert not-linked to flushing and making
    upstream elements stop.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776999