Kodi Community Forum
New MythTV add-on using libcmyth - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: New MythTV add-on using libcmyth (/showthread.php?tid=110694)



- cflynt - 2011-09-23

iscraigh Wrote:Still not having any luck installing, when I follow your commands I get..


Code:
craig@LR-frontend:/$ sudo git clone https://github.com/tsp/xbmc.git
Cloning into xbmc...
remote: Counting objects: 146384, done.
remote: Compressing objects: 100% (50429/50429), done.
remote: Total 146384 (delta 103449), reused 131530 (delta 92946)
Receiving objects: 100% (146384/146384), 286.94 MiB | 2.74 MiB/s, done.
Resolving deltas: 100% (103449/103449), done.
craig@LR-frontend:/$ cd xbmc/
craig@LR-frontend:/xbmc$ ./bootstrap
./bootstrap: 5: autoreconf: not found
craig@LR-frontend:/xbmc$ ls
addons        CONTRIBUTORS       gitrev.sh       LICENSE.GPL          media         README.linux   system    XBMC-ATV2.xcodeproj
bootstrap     copying.txt        keymapping.txt  m4                   project       README.osx     tools     XBMC-IOS.xcodeproj
build-aux     docs               language        Makefile.in          README.armel  README.ubuntu  userdata  XBMC.xcodeproj
configure.in  doxygen_resources  lib             Makefile.include.in  README.ios    sounds         xbmc      xbmc-xrandr.c

What am I missing?

Thanks

Craig

Ignore this I had not installed the build dependancies.

Also for other rookies I had to run the bootstrap/configure commands as sudo

You had to run the bootstrap/configure commands as sudo because you grabbed the repository as sudo, so your local user didn't have permissions to write to the directory. You can fix this in the future by doing a

Code:
sudo chown -R username.usernmae directory

username obviously being your local user and directory being the xbmc directory.


- tsp42 - 2011-09-23

dubstar_04 Wrote:I have tested the most recent git:

recording does indeed work.


Would you be able to have a look at :

- only pulling current and future timers in to xbmc
- sorting the recordings by date

Also xbmc locks up and uses a massive amount of memory (600+ MB) when launching and updating the tv database. I dont know if this is caused by the add-on or the xbmc.

Thank you,

Dubstar_04
The add-on caches the EPG information and I suspect that it can double the memory usage especially if you have hundreds or more channels. It should however be fixable. I will try to look into the sorting of the recordings. It will be easy to fix if XBMC uses the same order as the recordings are added.
I will try to figure out how to present the mythtv timers that matches titles instead of a specific time slot. I 'm not sure how mythtv handles it in the SQL database. Anyway I will try to implement it Sunday.

Another thing, remember to enable the extensive debug option in the addon configuratiob before posting the debug logs. It is disabled by default as it spams the log file.


- dubstar_04 - 2011-09-24

tsp42 Wrote:The add-on caches the EPG information and I suspect that it can double the memory usage especially if you have hundreds or more channels. It should however be fixable. I will try to look into the sorting of the recordings. It will be easy to fix if XBMC uses the same order as the recordings are added.
I will try to figure out how to present the mythtv timers that matches titles instead of a specific time slot. I 'm not sure how mythtv handles it in the SQL database. Anyway I will try to implement it Sunday.

Another thing, remember to enable the extensive debug option in the addon configuratiob before posting the debug logs. It is disabled by default as it spams the log file.

Wow, that would be cool if you could find time to have a look at the timers and recordings.

What is your intention going forward?

Do you aim to maintain the add-on and keep it sync'd with dushmaniacs branch?


- dubstar_04 - 2011-09-24

in function PVR_ERROR PVRClientMythTV::GetTimers(PVR_HANDLE handle)
I am using the following simple fix to only collect timers after the current time:

Code:
time_t timeNow;
      timeNow = time (NULL);
      if (tag.startTime < timeNow)
      continue;

after

Code:
tag.startTime=it->StartTime();

This is a simple fix and would probably need adjusting to capture currently happening recordings.

This has not been tested so may not work over a number of days, i.e if the database is updated?

I hope this helps.

Edit: This seems to be working ok. i've not tested it too much though.



Thanks,

Dubstar_04


- dubstar_04 - 2011-09-24

I have problem with the memory usage climbing to 1.5gb when the database is first populated. I.e if I delete the database from the settings and turn the client on the whole machine locks up.

Does anyone know how to find memory leaks?

Valgrind?

Thanks,

dubstar_04


- Blacksheep70 - 2011-09-25

Awesome work!

Works on my system and I didn't detect any issues so far!

Thumbs up for including that into the main XBMC tree!

Regards
Blacksheep


- dubstar_04 - 2011-09-25

If i wipe the database and run xbmc the memory used climbs and climbs until xbmc closes.

Logs are attached:

Valgrind: http://paste.ubuntu.com/696574/

Log: http://paste.ubuntu.com/696578/

I hope this helps,

Dubstar_04


- tsp42 - 2011-09-26

dubstar_04:
Thanks for trying to find the source of the high memory usage. Could you please provide me with the profiling file from valgrind Massif as I suspect it is not a true memory leak but more likely extensive duplication of the EPG data.
The recordings are unfortunately not sorted by the order that they are added to XBMC so I will have to change XBMC PVR to fix the ordering.
The fix for the old timers will come soon when I've merged the latest changes from XBMC PVR.


- dubstar_04 - 2011-09-26

tsp42 Wrote:dubstar_04:
Thanks for trying to find the source of the high memory usage. Could you please provide me with the profiling file from valgrind Massif as I suspect it is not a true memory leak but more likely extensive duplication of the EPG data.
The recordings are unfortunately not sorted by the order that they are added to XBMC so I will have to change XBMC PVR to fix the ordering.
The fix for the old timers will come soon when I've merged the latest changes from XBMC PVR.

I will try to run Massif tonight and provide feed back.

Would it not be possible to map the starttime of the recordings and sort by that before entering them into xbmc, or would that cause even more memory consumption?

on my system if i start xbmc, pvr manager runs and updates everything, the system then idles using 1.7GB of memory.
if i restart xbmc it idles at 48MB.

I dont really know what this represents but hopefully it will help you.

Thanks,

Dubstar_04


- tsp42 - 2011-09-26

dubstar_04 Wrote:Would it not be possible to map the starttime of the recordings and sort by that before entering them into xbmc, or would that cause even more memory consumption?
I tried that but XBMC PVR ignores the order that the recordings are added. I will have to find the place in the XBMC PVR source code where the recordings are sorted and change it. Maybe dushmaniac can give me a hint where to look.


- dubstar_04 - 2011-09-26

tsp42 Wrote:I tried that but XBMC PVR ignores the order that the recordings are added. I will have to find the place in the XBMC PVR source code where the recordings are sorted and change it. Maybe dushmaniac can give me a hint where to look.

dteirney has done a lot of work around the recordings and the way they are displayed. maybe he could advise or you could look through this code to see how he implemented the ordering system?

dteirneys post: http://forum.xbmc.org/showthread.php?tid=103945


Thanks,

dubstar_04


- dubstar_04 - 2011-09-26

I have tried getting a massif output but it seems to get killed before the pvr manager has completed its update process.

I have attached a number of logs. i hope these are useful


Massif output:

start new database: http://paste.ubuntu.com/697343/

update existing database:

one: http://paste.ubuntu.com/697347/
two: http://paste.ubuntu.com/697353/

run xbmc normally, allow to update, then run valgrind massif:

http://paste.ubuntu.com/697366/

this seems to provide better example of the update process rather than the previous two.

Thanks,

Dubstar_04


- tsp42 - 2011-09-26

dubstar_04:
Thanks. I can reproduce the leak now but only in linux not on windows. I will continue tomorrow finding the cause.


- dubstar_04 - 2011-09-26

Cool, I hope you can sort it without much trouble.

Thanks,

Dubstar_04


- tsp42 - 2011-09-27

The leak should be closed now.
Remarkable example of how well written the libcmyth code and documentation is :-)
Code:
/**
* Atomically decrement a reference count variable.
* \param valp address of atomic variable
* \return incremented reference count
*/
static inline unsigned
__mvp_atomic_decrement(mvp_atomic_t *valp)
{
    mvp_atomic_t __val;
#if defined __i486__ || defined __i586__ || defined __i686__
    __asm__ __volatile__(
        "lock xaddl %0, (%1);"
        "     inc   %0;"
        : "=r" (__val)