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 759871 - GstPlayer: Merge tags until media-info creation
GstPlayer: Merge tags until media-info creation
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.7.1
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-12-26 02:24 UTC by Yannick Inizan
Modified: 2016-01-06 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GstPlayer: Merge tags until media-info creation (996 bytes, patch)
2015-12-28 23:07 UTC, Yannick Inizan
rejected Details | Review
[graph] null-ready pipeline state change (66.44 KB, image/png)
2015-12-29 20:11 UTC, Yannick Inizan
  Details
[graph] ready-paused pipeline state change (820.54 KB, image/png)
2015-12-29 20:12 UTC, Yannick Inizan
  Details
[graph] paused-playing pipeline state change (725.42 KB, image/png)
2015-12-29 20:12 UTC, Yannick Inizan
  Details
typefind: Push cached events downstream in PULL mode if we don't handle them ourselves already (2.44 KB, patch)
2015-12-31 09:48 UTC, Sebastian Dröge (slomo)
none Details | Review
GstWebSrc as GstPushSrc (debug log) (398.42 KB, text/x-log)
2016-01-06 16:55 UTC, Yannick Inizan
  Details

Description Yannick Inizan 2015-12-26 02:24:23 UTC
when a custom source element is selected by playbin, and this element posts TAG messages, mediainfo or audio/video info have TagList empty or NULL.

TagList exists & captured if you add watch on playbin's bus.

custom plugin : http://github.com/inizan-yannick/gst-plugins

sample with 2 methods : http://pastebin.com/cyt8dQ2y
Comment 1 Yannick Inizan 2015-12-26 02:49:50 UTC
ok. gstplayer.c @ 1562 :

    if (gst_tag_list_get_scope (tags) == GST_TAG_SCOPE_GLOBAL) {

captured tags have STREAM scope, so never registered for media and other streams
Comment 2 Tim-Philipp Müller 2015-12-26 08:48:59 UTC
> when a custom source element is selected by playbin, and this element posts
> TAG messages, mediainfo or audio/video info have TagList empty or NULL.
> 
> TagList exists & captured if you add watch on playbin's bus.

Your source element should push the tags downstream as event, not post them on the bus. The sink will then post them on the bus.
Comment 3 Sebastian Dröge (slomo) 2015-12-26 08:55:34 UTC
And STREAM scope tags are collected by playbin in front of the sinks (if you send them as an event as you should), while GLOBAL scope tags are collected by GstPlayer from the bus. The STREAM scope tags are available via the tags of the specific stream in the GstPlayerMediaInfo, the GLOBAL scope tags are available directly in the GstPlayerMediaInfo.
Comment 4 Yannick Inizan 2015-12-26 21:22:45 UTC
no effects. plugin tags have GLOBAL scope and sent with event, media info & streams have empty tags.
Comment 5 Sebastian Dröge (slomo) 2015-12-26 23:49:31 UTC
Can you update the code of your source accordingly so we can reproduce the problem? It's still posting the tags as a message only here: https://github.com/inizan-yannick/gst-plugins/blob/2dea2fa7a9ef5e5999650081cd137a6f048ae7ec/src/WebVideoSrc.vala#L29
Comment 6 Yannick Inizan 2015-12-27 19:00:13 UTC
updated, but no effect. same thing if srcpad receive this event.
Comment 7 Sebastian Dröge (slomo) 2015-12-28 09:14:00 UTC
Can you provide a testcase that does not depend on gxml (it's not packaged by Debian), or can you provide a debug log to see what happens with the tags?

In theory they should appear in gstplayer.c:tags_cb() and then be merged into the media info. Note that you should wait for the media-info-updated signal, it might appear only a bit later than the state change.
Comment 8 Yannick Inizan 2015-12-28 23:07:39 UTC
Created attachment 317988 [details] [review]
GstPlayer: Merge tags until media-info creation
Comment 9 Sebastian Dröge (slomo) 2015-12-28 23:14:55 UTC
<breizhodrome> slomo, finally I solved my bug : https://bugzilla.gnome.org/show_bug.cgi?id=759871
<slomo> breizhodrome|out: the fix is not correct. the problem is that some element in the pipeline is not properly doing the tag aggregation
<slomo> breizhodrome|out: some element should do what you did there, but instead just posted tags as is
<slomo> breizhodrome|out: thanks for noticing :) now we only need to find the problematic element
Comment 10 Sebastian Dröge (slomo) 2015-12-29 08:28:49 UTC
Yannick, can you send a pipeline picture, i.e. a .dot file of the pipeline? Would be good to find the elements that are doing things wrong :)

As I see it, playbin and decodebin could possibly get some improvements for merging global tags and not forwarding tag messages of stream tags.
Comment 11 Tim-Philipp Müller 2015-12-29 09:54:30 UTC
Might be related to a demuxer, most demuxers don't expect upstream to send any tags, but just extract them from the stream.
Comment 12 Yannick Inizan 2015-12-29 20:11:25 UTC
Created attachment 318010 [details]
[graph] null-ready pipeline state change
Comment 13 Yannick Inizan 2015-12-29 20:12:09 UTC
Created attachment 318011 [details]
[graph] ready-paused pipeline state change
Comment 14 Yannick Inizan 2015-12-29 20:12:46 UTC
Created attachment 318012 [details]
[graph] paused-playing pipeline state change
Comment 15 Sebastian Dröge (slomo) 2015-12-30 08:55:04 UTC
So here it's at least matroskademux which does not expect tags from upstream and does not merge them with its own tags. It needs to do that in gst_matroska_demux_handle_sink_event() and wherever else it is outputting tags by itself it needs to merge them with the upstream ones first.

Do you want to provide a patch?
Comment 16 Yannick Inizan 2015-12-30 21:37:53 UTC
I've tried gst_element_send_event & gst_pad_push_event (gst_pad_send_event doesn't work - wrong direction) in my plugin, GST_EVENT_TAG never captured in gst_matroska_demux_handle_sink_event
Comment 17 Sebastian Dröge (slomo) 2015-12-30 22:53:36 UTC
<slomo> breizhodrome: interesting. can you get me a debug log with GST_DEBUG=6 and attach it to the bug?
<slomo> breizhodrome: that will explain what is happening here :)
<slomo> breizhodrome: push_event() is correct though. push sends the event to the peer pad. send lets a pad handle the event
Comment 18 Yannick Inizan 2015-12-31 02:45:56 UTC
log (49 MB) : http://www78.zippyshare.com/v/gMwDdu0H/file.html
Comment 19 Sebastian Dröge (slomo) 2015-12-31 09:47:03 UTC
The problem here is typefind. It's activating in PULL mode (your source supports that?) and in PULL mode we don't really forward events from upstream. Not only in typefind but everywhere.
Comment 20 Sebastian Dröge (slomo) 2015-12-31 09:48:23 UTC
Created attachment 318063 [details] [review]
typefind: Push cached events downstream in PULL mode if we don't handle them ourselves already

Otherwise upstream can't provide e.g. tags in PULL mode.
Comment 21 Sebastian Dröge (slomo) 2015-12-31 09:49:23 UTC
(In reply to Sebastian Dröge (slomo) from comment #20)
> Created attachment 318063 [details] [review] [review]
> typefind: Push cached events downstream in PULL mode if we don't handle them
> ourselves already
> 
> Otherwise upstream can't provide e.g. tags in PULL mode.

Undecided if this is a good idea. Opinions? :)

After typefinding has finished we would forward the events anyway (gst_pad_event_default() would).
Comment 22 Sebastian Dröge (slomo) 2015-12-31 09:52:45 UTC
From looking shortly at your code, I think you could base your source on giostreamsrc directly (i.e. make it a bin that has a giostreamsrc).

And also it seems like you always claim to support PULL mode, but whenever something is pulling data from a different offset you would return GST_FLOW_NOT_SUPPORTED unless the stream supports seeking. That's not ideal :) It should be known upfront if that can be done or not, and if you do PULL mode you must handle it.
Comment 23 Tim-Philipp Müller 2015-12-31 10:01:01 UTC
> > typefind: Push cached events downstream in PULL mode if we don't handle them
> > ourselves already
> > 
> > Otherwise upstream can't provide e.g. tags in PULL mode.
> 
> Undecided if this is a good idea. Opinions? :)
> 
> After typefinding has finished we would forward the events anyway
> (gst_pad_event_default() would).

Not sure I like this. It kind of blurs the boundaries a bit. I think the source should operate in push mode in this case.

Does pull mode really make sense here?
Comment 24 Sebastian Dröge (slomo) 2015-12-31 10:07:50 UTC
It doesn't, PULL mode generally is a bad idea for anything network based.
Comment 25 Sebastian Dröge (slomo) 2015-12-31 10:17:03 UTC
(In reply to Tim-Philipp Müller from comment #23)

> Not sure I like this. It kind of blurs the boundaries a bit.

Note that gst_pad_event_default() would forward events in PULL mode anyway. The event is only not forwarded here because we cache events before typefinding has finished. If the source would send the event later, it would work.
Comment 26 Yannick Inizan 2016-01-06 01:00:02 UTC
Gst.WebSrc is a subclass of Gst.Base.PushSrc in this branch, with srcpad.push_event for tags : https://github.com/inizan-yannick/gst-plugins/tree/push-mode

and player's media-info doesn't receive tags
Comment 27 Sebastian Dröge (slomo) 2016-01-06 08:02:25 UTC
Can you provide another debug log with that branch? Also you should consider making that branch the default, push mode is really better in your scenario here :)
Comment 28 Yannick Inizan 2016-01-06 16:55:18 UTC
Created attachment 318349 [details]
GstWebSrc as GstPushSrc (debug log)
Comment 29 Sebastian Dröge (slomo) 2016-01-06 17:23:41 UTC
GST_DEBUG=6 debug log please :)
Comment 30 Yannick Inizan 2016-01-06 17:55:09 UTC
Level 6 debug log : http://www11.zippyshare.com/v/KEH6KBwK/file.html
Comment 31 Sebastian Dröge (slomo) 2016-01-06 18:15:39 UTC
Ok, this is now matroskademux getting the TAG event but not doing anything with it. It should merge it with its own global tags and forward it.
Comment 32 Yannick Inizan 2016-01-06 21:07:53 UTC
ok. close it (because not a bug) and submit my patch for good plugins