Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7913 closed patch (fixed)

Improve performance of playback startup

Reported by: Jim Stichnoth <stichnot@…> 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)

speedup_cc708_init.patch (785 bytes) - added by Jim Stichnoth <stichnot@…> 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Jim Stichnoth <stichnot@…>

Attachment: speedup_cc708_init.patch added

comment:1 Changed 10 years ago by stuartm

Milestone: unknown0.23

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.

comment:2 Changed 10 years ago by stuartm

Component: MythTV - GeneralMythTV - Video Playback
Owner: changed from Isaac Richards to Janne Grunau
Priority: minormajor

comment:3 Changed 10 years ago by danielk

Owner: changed from Janne Grunau to danielk
Status: newaccepted

comment:4 Changed 10 years ago by danielk

Resolution: fixed
Status: acceptedclosed

(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:5 Changed 10 years ago by danielk

(In [23403]) Refs #7913. Remove debugging accidentally left in [23402].

comment:6 Changed 10 years ago by danielk

(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.

Note: See TracTickets for help on using tickets.