[mythtv] [Partial PATCH+BUG Report] MythVideo high CPU usage on Browser & freeze on Gallery

Colin Guthrie myth at colin.guthr.ie
Mon Aug 16 17:54:32 EDT 2004


Hi,

I've just updated to latest CVS and am experiencing probs with the 
Browser and Gallery modules.

When I load up the Browser (by the way I'm liking the new menu 
navigation!!), The CPU gives very high load when sitting doing nothing. 
I'm not very good with debuggers but I think this has something to do 
with QImage::isGreyScale() or convertFromImage according to some machine 
code that flys past in ddd. From this and a quick look at the code, I 
think this could be to do with something in uitypes.cpp but entirly unsure.

I can use the browser relativly OK despite the high CPU, so this is 
unlikly to be an infanite loop in the main thread I guess....

When I come across an movie without any coverart, it freezes on that 
entry in the browser for a while (few seconds) before letting me 
continue, which leads me to believe this problem is definatly image 
related in some way.


I've trolled over the latest commits to mythvideo and I see there has 
been significant restructuring, so not surprised this little bug has 
creaped in.

As for the Gallery, I'm sure I managed to use the cursor keys to 
navigate the folders once or twice, but it seems to stick immediatly 
when I try to repeat the test. So this view is totally unusable.



As a side note, I noticed a few things whilst looking through the code 
and addressed them in the attached patch.

1. Is there any reason why the MySQL query "SELECT LAST_INSERT_ID();" is 
not used to retrieve an auto_increment ID field upon data insertion? I 
can see this simplifing things... The attached patch converts three 
places in metadata.cpp where this may improve things slightly. Not 
overly important.
There may be a QT method of the mysql interface to get this data 
directly, as I know there is a C API function for this which I've used 
before (tho' not wrapped up by the QT stuff, just using the lib 
directly), so it would probably be more efficient to research this...
See http://dev.mysql.com/doc/mysql/en/ODBC_and_last_insert_id.html for 
more info.

2. I noticed a couple of weird things in the Metadata::dumpToDatabase 
method in metadata.cpp:
   a. The coverfile is set to the translation of "None" when it's blank, 
but the code to load the interface does not check for this when trying 
to load the image, so it will try to load an image called "None" quite a 
lot. I just figured it's best to leave this field totally empty rather 
than trying to put in a "None" text in the local language. It's pretty 
obvious to people that there is no cover file if the field is blank. I 
suppose the display code in the Manager could display the text "None" if 
the field is blank, but I think the data in the DB, /should/ be blank.

   b. I noticed in the same method (Metadata::dumpToDatabase) that there 
is a bug after insertion of the data into the DB. Immediately after 
these the data is inserted the updateGenres and updateCountries methods 
are called. These each use the "id" attribute internally, but the id of 
the newly inserted data is not retreived from the data till after these 
methods are called (and indeed, the way the id is retrieved is to search 
the database on the title, which in turn trashes any new Genre/COuntry 
info anyway). My use of the LAST_INSERT_ID() MySQL query should fix this 
as it grabs the id straight after inserting the data.

3. I noticed a type in the fillCountries method that would mean it 
appends things the the genres list rather than the countries one!!


Hope this helps.

PS I'd normally use bugzilla to report the bug and (separatly) supply 
the attached patch. I will still do this if requested, but I am unsure 
of the politics of making an "official" bug report so quickly after all 
the hard work of rearranging the mythvideo stuff. I'm also unsure as to 
whether to submit the bug reports against CVS version or whether this 
should be used only for release versions?

I think Bugzilla is great for feature requests tho' and I've got a 
couple opened myself for bits I'm working on just now (but still not 
finished lol - taking me ages to find the time to play!!). I use it 
loads at my work for bug reporting too, but don't want to tred on 
anyones toes here just yet ;)

All the best.

-- 

+------------------------+
|     Colin Guthrie      |
+------------------------+
|  myth at colin.guthr.ie   |
| http://colin.guthr.ie/ |
+------------------------+

Succeed in spite of management.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metadata.diff
Type: text/x-patch
Size: 4439 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20040816/f4c7d30b/metadata.bin


More information about the mythtv-dev mailing list