Opened 16 years ago
Closed 16 years ago
Last modified 16 years ago
#7913 closed patch (fixed)
Improve performance of playback startup
| Reported by: | Owned by: | danielk | |
|---|---|---|---|
| Priority: | major | Milestone: | 0.23 |
| Component: | MythTV - Video Playback | Version: | unknown |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
This patch reduces the "Please Wait...." delay when starting playback.
On my ION frontends, starting playback takes at least 4 seconds. About 650ms is spent in OSD::InitCC708(). This function calls LoadFont() 48 times (16 caption fonts times 3 font sizes), each instance taking about 15ms. In the default MythTV setup, all 16 fonts are the same -- this patch detects that situation and reuses the fonts, saving about 600ms. It may have an even greater residual effect, because log output like this:
playCtx: StartDecoderThread(): took 2023 ms to start player.
changes to something like this:
playCtx: StartDecoderThread(): took 930 ms to start player.
after the patch.
A better solution would be to cache the 48 fonts globally instead of creating and destroying them for every playback instance. I would look into that after the conversion of OSD to MythUI is complete. In the meantime, others with slow frontends may be interested in this patch.
Attachments (1)
Change History (7)
by , 16 years ago
| Attachment: | speedup_cc708_init.patch added |
|---|
comment:1 by , 16 years ago
| Milestone: | unknown → 0.23 |
|---|
comment:2 by , 16 years ago
| Component: | MythTV - General → MythTV - Video Playback |
|---|---|
| Owner: | changed from to |
| Priority: | minor → major |
comment:3 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → accepted |
comment:4 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
(In [23402]) Fixes #7913. Speed up font loading in OSD class by only loading each font name + size combination once per OSD.
Note: The patch supplied on the ticket resulted in multiple free's per TTFFont, so this solution is quite different -- but it is also more general and catches all instances of the same font being used multiple times in the OSD.
comment:6 by , 16 years ago
(In [23460]) Refs #7913. Fixes bug in [23402] identified by Jim Stichnoth.
TTFFont contains not only the font. It also contains the color, shadow and outline info. After [23402] any two TTFFont's that shared the same font would always have the same color, shadow and outline state. This fixes that by seperating out the font info from the other info. The font info itself is refernce counted and cleaned up once the last TTFFont referring to it is deleted.

Greg was looking at this a couple of years ago and did make some initial improvements, but he never found the time to go further.
One of the things I hoped to get out of the mythui port of the OSD was dropping the freetype dependency by drawing the CC with mythui. This would expand the available fonts to whatever was installed, improve the visual quality of CC and speed playback startup significantly.