GNOME Bugzilla – Bug 781725
ttml: Max number of GstMemorys in GstBuffer can be exceeded in live subtitling scenario
Last modified: 2017-04-25 19:24:18 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...
Created attachment 350403 [details] [review] ttmlparse: Don't leak TtmlElements when deleting GNodes/trees
Created attachment 350405 [details] [review] ttmlparse: Remove redundant text_index field of TtmlElement
Created attachment 350406 [details] [review] ttmlparse: Replace repeated warning code with a function
Created attachment 350407 [details] [review] ttmlparse: Store newline as text of br element
Created attachment 350408 [details] [review] ttmlparse: Don't add GstMemorys to a GstBuffer that is full
Created attachment 350409 [details] [review] ttmlparse: Consolidate adjacent co-styled inline elements
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