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 781725 - ttml: Max number of GstMemorys in GstBuffer can be exceeded in live subtitling scenario
ttml: Max number of GstMemorys in GstBuffer can be exceeded in live subtitlin...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 1.11.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-25 14:59 UTC by Chris Bass
Modified: 2017-04-25 19:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
TTML file containing live-style subtitles (2.21 KB, text/xml)
2017-04-25 14:59 UTC, Chris Bass
  Details
ttmlparse: Don't leak TtmlElements when deleting GNodes/trees (1.08 KB, patch)
2017-04-25 15:02 UTC, Chris Bass
committed Details | Review
ttmlparse: Remove redundant text_index field of TtmlElement (1.39 KB, patch)
2017-04-25 15:02 UTC, Chris Bass
committed Details | Review
ttmlparse: Replace repeated warning code with a function (2.92 KB, patch)
2017-04-25 15:03 UTC, Chris Bass
committed Details | Review
ttmlparse: Store newline as text of br element (2.86 KB, patch)
2017-04-25 15:03 UTC, Chris Bass
committed Details | Review
ttmlparse: Don't add GstMemorys to a GstBuffer that is full (4.93 KB, patch)
2017-04-25 15:04 UTC, Chris Bass
committed Details | Review
ttmlparse: Consolidate adjacent co-styled inline elements (7.11 KB, patch)
2017-04-25 15:05 UTC, Chris Bass
committed Details | Review

Description Chris Bass 2017-04-25 14:59:45 UTC
Created attachment 350402 [details]
TTML file containing live-style subtitles

An important subtitling use case is live-generated subtitles, in which each new word is contained in its own span, and the spans are displayed sequentially, with the effect that lines of displayed subtitles are built up word-by-word.

This can, however, cause problems with the TTML code when the number of words in a block is greater than the number of allowed GstMemorys in a GstBuffer, since ttmlparse will attempt to insert each new span in its own GstMemory.

The attached file (live-subs.xml) demonstrates the problem; run as follows:

gst-launch-1.0 ttmlrender name=r videotestsrc pattern="gradient" ! video/x-raw,width=1280,height=720 ! autovideoconvert ! r.video_sink filesrc blocksize=16777216 location=live-subs.xml ! ttmlparse ! r.text_sink r. ! ximagesin

Since in this use case each span will have the same styling as adjacent spans, we can join adjacent spans (and other inline elements, such as breaks) into a single element containing the concatenated text of each, thus avoiding the limit of GstMemorys in a GstBuffer and also reducing the amount of styling/layout metadata that is attached to each buffer.

Patchset to follow...
Comment 1 Chris Bass 2017-04-25 15:02:13 UTC
Created attachment 350403 [details] [review]
ttmlparse: Don't leak TtmlElements when deleting GNodes/trees
Comment 2 Chris Bass 2017-04-25 15:02:40 UTC
Created attachment 350405 [details] [review]
ttmlparse: Remove redundant text_index field of TtmlElement
Comment 3 Chris Bass 2017-04-25 15:03:21 UTC
Created attachment 350406 [details] [review]
ttmlparse: Replace repeated warning code with a function
Comment 4 Chris Bass 2017-04-25 15:03:47 UTC
Created attachment 350407 [details] [review]
ttmlparse: Store newline as text of br element
Comment 5 Chris Bass 2017-04-25 15:04:41 UTC
Created attachment 350408 [details] [review]
ttmlparse: Don't add GstMemorys to a GstBuffer that is full
Comment 6 Chris Bass 2017-04-25 15:05:08 UTC
Created attachment 350409 [details] [review]
ttmlparse: Consolidate adjacent co-styled inline elements
Comment 7 Sebastian Dröge (slomo) 2017-04-25 19:23:32 UTC
Attachment 350405 [details] pushed as 8b19ccc - ttmlparse: Remove redundant text_index field of TtmlElement
Attachment 350407 [details] pushed as ef65230 - ttmlparse: Store newline as text of br element
Attachment 350408 [details] pushed as 22c3830 - ttmlparse: Don't add GstMemorys to a GstBuffer that is full
Attachment 350409 [details] pushed as acfaf3a - ttmlparse: Consolidate adjacent co-styled inline elements