[TV] - HD-PVR TV freezes After Channel Change When using SPDIF | Page 2

Discussion in '1.3.x' started by cwchapma, April 27, 2013.

  1. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,495
    Likes Received:
    4,709
    Ratings:
    +8,170 / 17
    Home Country:
    New Zealand New Zealand
    Hello again

    Warning: some of the info below is quite technical!

    Channel changing with a capture device is always going to be interesting. It happens like this:
    1. Watching channel A, select channel B. MediaPortal tells TV Server to change channel.
    2. TV Server tells blaster to send command to switch to channel B. The blaster starts doing its thing - this carries on in the background of the following steps.
    3. TV Server goes through channel change for an analog tuner (ie. make sure correct inputs are selected).
    4. TV Server/TsWriter start waiting for PMT to determine what audio, video and subtitle streams will be present.
    5. PMT received, wait for audio and video.
    6. Audio and video seen, TV Server tells MediaPortal it has finished changing channel.
    7. MediaPortal sets up TsReader splitter waits to receive PMT.
    8. TsReader receives PMT, reads and decodes and tells MediaPortal what video, audio and subtitle streams are present.
    9. MediaPortal connects appropriate/configured codecs and tells TsReader and the codecs to start doing their jobs, the result being that you see video and hear audio.
    Now, the "interesting" thing in all this is... timing and PMT.
    MP and TV Server can (and usually do) complete a whole channel change sequence before the external tuner has finished changing channel.
    Everything that is done during the channel change, especially selection of codecs, tends to be done as if you were still streaming channel A.
    Thus the whole chain from HD-PVR through to your screen will see and have to cope with any glitches that are generated as a natural consequence of the external tuner changing from channel A to B.
    By glitches, I mean:
    1. The change from channel A to nothing.
    2. The nothingness itself... which tends to be garbage.
    3. The change from nothing to channel B.
    These glitches propagation through the entire chain: HD-PVR, TsWriter, HDD, streaming server and RTSP connection (for multi-seat), TsReader, codecs and renderer.

    PMT is a "clump" of info about the video, audio and subtitle streams that are present. This info is produced by the HD-PVR and parsed by TsWriter and TsReader. TsWriter (and TV Server in general) don't really care about the content of the PMT except that it determines what streams are included in the timeshift file. For the purposes of an HD-PVR that never changes, so TV Server tends to be pretty immune the the glitches. A key point to keep in mind is that TV Server doesn't remove the glitches either - it can't, because it has no idea when the external tuner actually finishes tuning. Everything just flows right on through to MP (or XBMC or whatever other front end is in use).

    The most fragile parts of the chain are the codecs and the RTSP connection (and I suppose TsReader to a lesser degree). When a codec tries to decode garbage it will often result in visible pixelation/freezing or audible pops. My understanding (and @Owlsroost will surely correct me!) is that failure of the audio codec can cause the video to stop as well.

    I think the most interesting parts of all of this are #3 and #6.
    Both are telling me maybe in this particular case the absence of data (ie. the codecs and/or TsReader running out data to decode) is the issue.
    Of further interest is that this only happens with S/PDIF. I guess the difference is that from the HD-PVR's perspective, S/PDIF audio data is either present or not. In other words, there is a marked glitch. With line audio, the absence of signal is just silence...



    I think:
    • it would be worthwhile to try to reproduce the problem on a single-seat system (ie. eliminate RTSP)
    • it would be worthwhile to try different audio codecs

    @Owlsroost
    Whaddaya think?
    Is there anything that we can do on the TV Server side or in TsWriter to improve the situation? I'm thinking things like suppressing PMT changes by waiting for the second (or even third) PMT before allowing the channel change to complete.

    Note: with a Colossus or change involving switching of inputs, often there will be 3 PMTs seen:
    1. Old channel PMT.
    2. Default PMT (indicating input not detected).
    3. New channel PMT.

    mm
     
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. cwchapma

    cwchapma Portal Pro

    Joined:
    October 15, 2006
    Messages:
    56
    Likes Received:
    17
    Ratings:
    +22 / 0
    Home Country:
    Canada Canada
    Show System Specs
    Thanks for the all the info. It does give me a better understanding of what's going on. I saw "pmt" in the logs and wondered what it was.

    I was guessing the same. I think the same thing happens when comskip overloads the system and it ends up skipping some of the live tv and running out of data.

    I have tried different audio codecs since it seemed dependent on the type of audio input. There was no change.
    If I run the client on the machine I'm using as a server, would that eliminate RTSP or is there something different in the install for a single seat?

    Thanks again for look at this.

    Clint
     
  4. HomeY
    • Team MediaPortal

    HomeY Test Group

    Joined:
    February 23, 2008
    Messages:
    6,460
    Likes Received:
    2,626
    Gender:
    Male
    Occupation:
    Network Engineer
    Location:
    ::1
    Ratings:
    +4,736 / 16
    Home Country:
    Netherlands Netherlands
    Show System Specs
  5. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,495
    Likes Received:
    4,709
    Ratings:
    +8,170 / 17
    Home Country:
    New Zealand New Zealand
    Okay.


    Yes, when running MP in single-seat RTSP is not used.

    This is true... but single-seat is more reliable in general, so I'd prefer results from that environment. ;)

    mm
     
    • Like Like x 1
  6. cwchapma

    cwchapma Portal Pro

    Joined:
    October 15, 2006
    Messages:
    56
    Likes Received:
    17
    Ratings:
    +22 / 0
    Home Country:
    Canada Canada
    Show System Specs
    Running the the mediaportal client on the server doesn't seem to have the same issue. It stutters a bit but doesn't freeze.

    So does that give some clue as to how to get it working on a network client?
     
    • Like Like x 1
  7. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,495
    Likes Received:
    4,709
    Ratings:
    +8,170 / 17
    Home Country:
    New Zealand New Zealand
    Hmmm, okay - this is good to know... and I suspected that might be the case.

    So can you confirm that the behaviour is consistent?
    ie. there is consistent freeze in the multi-seat scenario, and it consistently stutters but doesn't freeze in the single-seat scenario

    Not really for me. It proves that the issue is a client side or RTSP issue... which I was already pretty sure of.
    From here you really need assistance from somebody familiar with TsReader and RTSP to find some time to look into the problem.
    @Owlsroost is the resident expert in that domain, and @georgius may also have some comments.

    At this point I would also try the suggestion from HomeY to further narrow down the issue.
     
    Last edited: May 2, 2013
  8. cwchapma

    cwchapma Portal Pro

    Joined:
    October 15, 2006
    Messages:
    56
    Likes Received:
    17
    Ratings:
    +22 / 0
    Home Country:
    Canada Canada
    Show System Specs
    UNC paths seem to fix the issue on a network client. I think it might be dropping a few more frames. That's probably usable for me.

    RTSP would be nice but this is a big step forward. Thanks @HomeY and @mm1352000.

    If anybody has any ideas about how to get RTSP to work, I'd be happy to test them out. It would be nice if this just worked by default plus I imagine there's a reason RTSP is the default. This ends up being just one more special configuration I need to set. I've already got a lot of those. :)

    Thanks again,
    Clint
     
    • Like Like x 2
  9. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,495
    Likes Received:
    4,709
    Ratings:
    +8,170 / 17
    Home Country:
    New Zealand New Zealand
    Right - excellent. :)



    Maybe you could try this TsReader which apparently has some improvements to the RTSP handling in TsReader:
    https://forum.team-mediaportal.com/...reader-development.102693/page-86#post-989589
     
  10. cwchapma

    cwchapma Portal Pro

    Joined:
    October 15, 2006
    Messages:
    56
    Likes Received:
    17
    Ratings:
    +22 / 0
    Home Country:
    Canada Canada
    Show System Specs
    I tried opening the rtsp stream in VLC. It had pretty much the same problem only it didn't just freeze it gave up and closed the stream. If the stream was delayed a bit from live, it would stutter through the channel change and play fine after as well.[DOUBLEPOST=1367464122][/DOUBLEPOST]Tried v73 of the TsReader.ax you suggested. No change. Thanks for the suggestion though.
     
  11. Owlsroost
    • Team MediaPortal

    Owlsroost Development Group

    Joined:
    October 28, 2008
    Messages:
    5,495
    Likes Received:
    2,764
    Location:
    Cambridge
    Ratings:
    +4,040 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Based on the fact that a UNC path works (which basically operates like single-seat mode but with the timeshift file on a remote drive), and that VLC gives up (presumably because it's not getting any data, and times out after a while), I suspect that this is a problem with the RTSP streaming server in TV server.

    In timeshift (live) mode TsReader will not give up and drop the stream because it assumes that live TV is everlasting, so it just freezes if the data stops. If the video stops but the audio continues then the video decode filter may have hung, or the video is always late so it gets dropped before it can be rendered to the screen.

    When it gets stuck, what happens if you pause TV for a few seconds - does it fix it ?
     
    • Like Like x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!