IPTV/DVB-IP in MP: Support for http, rtp and udp (4 Viewers)

georgius

Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    655
    Bratislava
    Home Country
    Slovakia Slovakia
    Re: AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi,

    I successfully compiled your source codes in Visual Studio 2010, so now I'm going to debug where is problem. I hope that I will have good news ASAP.
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    655
    Bratislava
    Home Country
    Slovakia Slovakia
    Re: AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi,

    it's time to report progress. Until now I can't say that I make any progress. UDP part is still not working and I don't know why. It seems that for me the old filter provided with MP 1.1.2 (its same for 1.1.3) is the only one which works.

    For Stepko: Are source codes of MPIPTVSource in SVN (revision 27688) the same as filter provided for MP 1.1.2?

    I'll try to compile sources from SVN and check how was working the old filter.
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    655
    Bratislava
    Home Country
    Slovakia Slovakia
    Hi,

    I hope that I have good news (for someone). I finally stabilize UDP streams. On my computer it works without any loss of packets, video is smooth, sound the same. In logs aren't discontinuity errors. So from my opinion UDP streams are working. In attachement are two filters: one release and one debug (if you have any errors, please, use for testing and send me logs).

    Installation
    To use the new version just follow these simple steps:

    • Stop the TV service in the TV Config (under "Manual Control")
    • Go to the TV server directory (e.g. C:\Program files\Team MediaPortal\MediaPortal TV Server)
    • Make a backup of the original MPIPTVSource.ax
    • Replace the original file with the one attached
    • Start the TV Service in the TV Config
    Important
    Because of big changes in source code and in first case I want to make UDP working the RTP and HTTP are not working! I'll make necessary changes and post newer version with RTP and HTTP as soon as possible.
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    655
    Bratislava
    Home Country
    Slovakia Slovakia
    Hi,
    new filter is combination of these two algorithms. I studied old implementation - how it works, but in logs I saw that it had discontinuity error (video was choppy, audio same - of course from time to time), I studied new implementation with cyclic buffer (however I implemented new cyclic buffer class for this purpose) and also studied working filters. It is something between these approaches. When I finish necessary changes I'll post here source codes for comparing.

    In any way: big thanks to Stepko for his effort to develop this filter.
     

    Stepko

    Retired Team Member
  • Premium Supporter
  • September 29, 2007
    186
    152
    Hamburg/Wolfsburg
    Home Country
    Germany Germany
    AW: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi,

    great news that you got udp running! Do you know what was wrong in my code? I really would like to know where I did the mistake :D

    Yes, the old filter had a lot of dropped packets on udp and rtp. Thats why I switched the method of getting the data from polling to callback (registering an event in this case). And that fixed the problem.

    Did you implement a different approach of the buffer?

    :D for your help
    Stepko
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    655
    Bratislava
    Home Country
    Slovakia Slovakia
    Re: AW: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi,

    because there is need to post here sorce codes ... they are in attachement. The HTTP and RTP are not rewritten. I'll shortly describe where were problems.

    The first problem was that UDP streams after while (in new Stepko's version of filter) stops. It takes me more than two days to know this: when you leave multicast group than you must wait at least 0.5 second to join next group (probably problem with routers). For sure the filter waits 1 second on when destroying main thread.

    The second problem were loosed packets (discontinuity error is TsReader.log in MP). In Stepko's old filter it caused the main loop, in new filter it hasn't been working. I rewritten the code according to MSDN documentation (bind() is strongly recommended before joining multicast group) and used new thread in Stepko's new filter to acquire data from stream. I also removed some code in this thread (waiting for events) and returned back to recvfrom() method (in unblocking mode it returns WSAEWOULDBLOCK error which means that there aren't any data).

    As I said in previous post, it's combination of old and new Stepko's algorithms. Also the main loop (in Stepko's old algorithm DoBufferProcessingLoop() method) was returned back, I took it from TsReader implementation.

    For RTP and HTTP streams: can someone post here addresses of working streams?
     

    velis

    MP Donator
  • Premium Supporter
  • July 16, 2009
    237
    50
    Radovljica
    Home Country
    Slovenia Slovenia
    Georgius,

    I'm currently testing your new filter (the release version) and so far it works well.

    I find it strange though: Actually I'm the author of current SVN version and it was all well until version 1.1. It is only lately that it started skipping. Actually so much that I was bugging my provider about this without verifying on their own STB... Turns out their STB didn't skip :rolleyes:

    Now, fortunately you turned up and fixed the problem for me :D

    Now, what about that missing signal stuff - playback of a static clip when no signal? :p

    --------------------------------------------------------------------------------------------------------------
    Edit: After some 15 minutes, my TV just froze :( I went checking and I saw you have the same problems I had (100% CPU usage, etc.) please read the thread I linked to above carefully because inside it you will find many pitfalls this filter has.
    Basics:
    Use Select() to drop CPU usage, but be careful how you use it (recvfrom() + select() + recvfrom() - there must be very little code in between these calls.
    Don't use Sleep - 0 doesn't drop CPU usage, anything higher causes dropped packets.

    Suggestion:
    The actual reader thread should have top priority and do nothing but the three calls + fetching the next buffer from a buffer pool + putting the full buffers into another pool. *Only* in case the buffer pool is empty should it malloc another buffer.
    The main thread should be responsible for creating new buffers for the buffer pool + fetching filled buffers from reader thread + passing buffers to mm (dshow) system. It should lock both buffer lists minimally or not at all if possible.
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    655
    Bratislava
    Home Country
    Slovakia Slovakia
    Hi,

    you didn't write which process takes so much CPU time. Can you test again and write which process (or processes)? Can you test with debug version of filter and post here logs?

    Can you post here your TsReader log before you begin testing again?
     

    Users who are viewing this thread

    Top Bottom