GNOME Bugzilla – Bug 341681
[textoverlay] flickering with continuously timestamped text
Last modified: 2006-11-21 18:41:26 UTC
Please describe the problem: I'm working sami parser and pangocairo textoverlay plugin. You can see them bug 169936 and bug 340887 And some sami subtitles are often used for karaoke like below. ex) <SYNC START=32538><P CLASS=KRCC> I believe<BR> I believe <SYNC START=32571><P CLASS=KRCC> <font color=#33BEF1>I</FONT> believe<BR> I believe <SYNC START=33247><P CLASS=KRCC> <font color=#33BEF1>I be</FONT>lieve<BR> I believe <SYNC START=33984><P CLASS=KRCC> <font color=#33BEF1>I believe</FONT><BR> I believe I'll attach sample smi file. When play above smi file, each frames are render with some delay. (it shows like didn't use double buffer) Steps to reproduce: 1. apply bug 169936 and bug 340887 patch at gst-plugins-base 2. run this command $ gst-launch -v filesrc location=./test.smi ! subparse ! txt. videotestsrc ! textoverlay name=txt font-desc=Sans\ 30 ! ffmpegcolorspace ! ximagesinkk Actual results: render smoothly. Expected results: render with some delay. Does this happen every time? yes. Other information: When render with textrender plugin, It renders smoothly. You can use this command. $ gst-launch -v filesrc location=./test.smi ! subparse ! textrender font-desc=Sans\ 30 ! ffmpegcolorspace ! ximagesink You must resize window after above command. textoverlay and textrender plugins are same render algorithm. I think this bug is not relate with textoverlay plugin, this bug appear pango textoverlay plugin (based pango freetype backend), too. I think this bug will be related with video image mixing layer or something equality[
Created attachment 65399 [details] test sami file for karaoke
I made simple case. There is no need to patch. I'll append test.srt. It just contained 'Hello?' strings and there are no delay times between each strings.
Created attachment 65417 [details] test srt file
Basically, textoverlay's logic is a bit busted. Besides a few < vs. <= comparison mixups, it won't wait for a text buffer if it doesn't have a text buffer available, which is what leads to the flickering. Also, it doesn't discard text buffers after using them if they aren't needed any longer. And a few other things that aren't quite right either. Will fix after the freeze.
This should fix it: 2006-11-21 Tim-Philipp Müller <tim at centricular dot net> * ext/pango/gsttextoverlay.c: (gst_text_overlay_init), (gst_text_overlay_text_pad_unlink), (gst_text_overlay_text_event), (gst_text_overlay_video_event), (gst_text_overlay_pop_text), (gst_text_overlay_text_chain), (gst_text_overlay_video_chain), (gst_text_overlay_change_state): * ext/pango/gsttextoverlay.h: Some textoverlay fixes: for one, in the video chain function, actually wait for a text buffer to come in if there is none at the moment and there should be one; also, deal more gracefully with incoming buffers that do not have a timestamp or duration; discard text buffer when not needed any longer. Fixes #341681. * tests/check/Makefile.am: * tests/check/elements/.cvsignore: * tests/check/elements/textoverlay.c: (notgst_check_setup_src_pad2), (notgst_check_teardown_src_pad2), (setup_textoverlay), (buffer_is_all_black), (create_black_buffer), (create_text_buffer), (cleanup_textoverlay), (GST_START_TEST), (test_video_waits_for_text_send_text_newsegment_thread), (test_video_waits_for_text_shutdown_element), (test_render_continuity_push_video_buffers_thread), (textoverlay_suite): Add some unit tests for textoverlay.