TV Server Crashes After Recording Ends (1 Viewer)

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Filter is starting to receive stream
    Ahhh. This is unexpected, unintended and not really desirable from TV library's (my) perspective. :(

    TV library doesn't intend for the filter to try to receive the stream until the graph is started. From TV library's perspective, IMediaControl (graph control) is used for stream start, stop and pause; IFileSourceFilter is only used to provide the URL (tuning parameters). Unless the graph is running when Load() is called, the library doesn't expect the filter to do anything except record/cache the parameters and prepare to connect/stream.

    One reason for this expectation is that tuning can be cancelled. It is possible that Load() could be called without IMediaControl.Run() (due to tune cancellation from the user), and it is expected that the filter should have no problem with that.

    It is also expected that IMediaControl.Run() + Stop() + Run() might be called without Load(). The filter would just use the existing URL, and control the connection/streaming as required.

    If error happens, filter returns error (if it can't handle it). The most common case is no data received within specified timeout or can't open connection.
    -32 (0xFFFFFFE0) is defined as E_CONNECTION_LOST_CANNOT_REOPEN, but while opening connection it means that no data are received within specified timeout.
    Okay. Such an error would be completely unexpected, because TV library didn't intend for the filter to try to open any connection or receive data. Only parse the URL and apply the required configuration.

    Seems like the filter implementation is currently incompatible with TV library. :(
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    Ahhh. This is unexpected, unintended and not really desirable from TV library's (my) perspective. :(

    TV library doesn't intend for the filter to try to receive the stream until the graph is started. From TV library's perspective, IMediaControl (graph control) is used for stream start, stop and pause; IFileSourceFilter is only used to provide the URL (tuning parameters). Unless the graph is running when Load() is called, the library doesn't expect the filter to do anything except record/cache the parameters and prepare to connect/stream.
    This could be correct for TV library, but is not usable in OnlineVideos, which uses same filter. Before calling IMediaControl.Run() you need to construct graph, but for constructing graph you need output pins. But you can't create output pins without receiving data and parsing stream.

    One reason for this expectation is that tuning can be cancelled. It is possible that Load() could be called without IMediaControl.Run() (due to tune cancellation from the user), and it is expected that the filter should have no problem with that.
    That is big problem, because data are received, until called Stop() or destroyed filter instance.

    It is also expected that IMediaControl.Run() + Stop() + Run() might be called without Load(). The filter would just use the existing URL, and control the connection/streaming as required.
    This sequence of calls leads to crash. For now it is not possible to call Run() after Stop() without successful calling Load().

    If error happens, filter returns error (if it can't handle it). The most common case is no data received within specified timeout or can't open connection.
    -32 (0xFFFFFFE0) is defined as E_CONNECTION_LOST_CANNOT_REOPEN, but while opening connection it means that no data are received within specified timeout.
    Okay. Such an error would be completely unexpected, because TV library didn't intend for the filter to try to open any connection or receive data. Only parse the URL and apply the required configuration.

    Seems like the filter implementation is currently incompatible with TV library. :(
    Yep, partially incompatible, but mostly it works. It seems that problem with Load() method is not solved also for DVB-IP card, but if I correct remember @Sebastiii was working on fix. At least, we discussed about this problem.

    I think that not checking Load() method error code is bigger problem than opening stream. Because Load() method can return any other error code, like E_OUTOFMEMORY or E_INVALIDARG.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    This could be correct for TV library, but is not usable in OnlineVideos, which uses same filter. Before calling IMediaControl.Run() you need to construct graph, but for constructing graph you need output pins. But you can't create output pins without receiving data and parsing stream.
    But surely for TV library there would only ever be one pin - MPEG 2 TS?

    One reason for this expectation is that tuning can be cancelled. It is possible that Load() could be called without IMediaControl.Run() (due to tune cancellation from the user), and it is expected that the filter should have no problem with that.
    That is big problem, because data are received, until called Stop() or destroyed filter instance.
    ...
    This sequence of calls leads to crash. For now it is not possible to call Run() after Stop() without successful calling Load().
    Yes, I thought it might be, and that's exactly why I pointed it out. This is not something that the TV library can change. The only workaround would be to destroy the graph when the tuner is not in use... but this undesirable graph rebuilding would result in slower performance.

    Yep, partially incompatible, but mostly it works.
    Yep, streaming channels does work, however it is not really robust. "Mostly it works"... if everything goes as expected (server/source available etc.). ;)

    It seems that problem with Load() method is not solved also for DVB-IP card, but if I correct remember @Sebastiii was working on fix. At least, we discussed about this problem.

    I think that not checking Load() method error code is bigger problem than opening stream. Because Load() method can return any other error code, like E_OUTOFMEMORY or E_INVALIDARG.
    I agree that TVL should catch errors. In fact, TVE 3.5 already does that (and has done so for a long time):
    https://github.com/MediaPortal/Medi...tations/DirectShow/Stream/TunerStream.cs#L243

    (Same code is used for both CableCARD and normal IPTV/stream/DVB-IP "tuners".)
    However, detecting Load() errors by itself is meaningless unless you also remove the filter or destroy the graph.

    Ultimately my point is that it probably is not possible to create a single filter that is completely compatible with OV and TVL requirements. Right now the filter seems more compatible with OV (which is completely understandable), but proper compatibility with TVL requires changes in the filter (...and maybe TVL as well). From the filter side, I wonder if it wouldn't be better to create/register two filters using the same core code with customised behaviour (eg. different pin creation and streaming)?
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    But surely for TV library there would only ever be one pin - MPEG 2 TS?
    Yes, it's forced.

    Yes, I thought it might be, and that's exactly why I pointed it out. This is not something that the TV library can change. The only workaround would be to destroy the graph when the tuner is not in use... but this undesirable graph rebuilding would result in slower performance.
    I don't see any reason, why opening stream code cannot be moved to Run() method in IPTV case.

    Yep, streaming channels does work, however it is not really robust. "Mostly it works"... if everything goes as expected (server/source available etc.). ;)

    I agree that TVL should catch errors. In fact, TVE 3.5 already does that (and has done so for a long time):
    https://github.com/MediaPortal/Medi...tations/DirectShow/Stream/TunerStream.cs#L243

    (Same code is used for both CableCARD and normal IPTV/stream/DVB-IP "tuners".)
    However, detecting Load() errors by itself is meaningless unless you also remove the filter or destroy the graph.

    Ultimately my point is that it probably is not possible to create a single filter that is completely compatible with OV and TVL requirements. Right now the filter seems more compatible with OV (which is completely understandable), but proper compatibility with TVL requires changes in the filter (...and maybe TVL as well). From the filter side, I wonder if it wouldn't be better to create/register two filters using the same core code with customised behaviour (eg. different pin creation and streaming)?
    It is possible to create single filter, but must be implemented slightly different in IPTV and in splitter case. Also calling sequence Run() -> Stop() -> Run() is possible to implement. Until now I don't have any reason to do it, because in OnlineVideos is common case that url between two Load() calls is different and also DVB-IP implementation in TV library always destroyed and created filter.
     

    Sigpi007

    Portal Pro
    November 14, 2012
    104
    38
    Chicago, IL
    Home Country
    United States of America United States of America
    (hey all... not wanting to interupt, but providing a couple extra bits of information)

    1. The initial crash was at 7:57pm... the second was around 8:04pm. This confirms mm's observations from the logs.

    2. New info... after a full reboot this morning of both PC and CableCard Tuner, I was STILL unable to tune channel 220. (However 203 worked fine.) I believe both symptoms may be related to the feed specifically from channel 220. I'm going to do more testing, but it might be possible that the cable company changed something that no longer allows me to decrypt that channel. This could have caused an unexpected situation which drove the error in the TV server.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    @Sigpi007
    Regarding channel 220: the program number (service ID) or PMT PID may have changed, resulting in the "PMT not found" error, which in turn leads to the crash scenario. A rescan to get the correct details may fix the problem with that channel.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    @Sigpi007
    Regarding channel 220: the program number (service ID) or PMT PID may have changed, resulting in the "PMT not found" error, which in turn leads to the crash scenario. A rescan to get the correct details may fix the problem with that channel.

    Hi :)

    I remember adding something for live PMT change on TVE side but not sure it was ok to do like this.
    Clubbing HDTV (from my IPTV provider) has many source server, so sometimes it take server1 with PMT1 and sometimes server2 with PMT2 and so on.

    I notice from log that good PMT can be detected but TVE use the one store in DB, so in case of PMT1 failed, i change the code to use PMT2 (or the corrected one detected) and it WORKS !!!!!

    I experiment/tested it on my own build as workaround but still it works. This change is done on TVE side.

    But Georgius as create a plugin too but it seems not change live PMT, i need to retest.

    Maybe i will able to supply the change i made for analysing from @mm1352000 :)

    Btw, you never sleep :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Here the log : i have added some log line :

    [2015-01-09 19:23:23,076] [65f8060] [3750] - pmtgrabber: set callback:542fff8
    [2015-01-09 19:23:23,077] [65f8060] [3750] - pmtgrabber: grab pmt:42 sid:1777
    [2015-01-09 19:23:23,077] [65f8060] [3750] - cagrabber: set callback:542ffc8
    [2015-01-09 19:23:23,077] [65f8060] [3750] - cagrabber: reset
    [2015-01-09 19:23:23,224] [65f8060] [3730] - pmtgrabber: got pmt 42 sid:bd1e
    [2015-01-09 19:23:23,224] [65f8060] [3730] - pmtgrabber: serviceid mismatch bd1e != 1777
    [2015-01-09 19:23:23,224] [65f8060] [3730] - pmtgrabber: trying to use new detected serviceid bd1e
    [2015-01-09 19:23:23,224] [65f8060] [3730] - pmtgrabber: grab pmt:42 sid:bd1e
    [2015-01-09 19:23:23,224] [65f8060] [3730] - CPmtGrabber::OnNewSection() - Error decoding PMT from new section, bad signal?
    [2015-01-09 19:23:23,828] [65f8060] [3730] - pmtgrabber: got pmt 42 sid:1777
    [2015-01-09 19:23:23,828] [65f8060] [3730] - pmtgrabber: serviceid mismatch 1777 != bd1e
    [2015-01-09 19:23:23,828] [65f8060] [3730] - pmtgrabber: trying to use new detected serviceid 1777
    [2015-01-09 19:23:23,828] [65f8060] [3730] - pmtgrabber: grab pmt:42 sid:1777
    [2015-01-09 19:23:23,828] [65f8060] [3730] - CPmtGrabber::OnNewSection() - Error decoding PMT from new section, bad signal?
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pmtgrabber: got pmt 42 sid:1777
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pmtgrabber: PMT pids changed from:
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pcr pid: 0
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pmt pid: 0
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pmtgrabber: PMT pids changed to:
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pcr pid: 200
    [2015-01-09 19:23:24,100] [65f8060] [3730] - pmt pid: 42
    [2015-01-09 19:23:24,100] [65f8060] [3730] - video pid: 200 type: H264
    [2015-01-09 19:23:24,100] [65f8060] [3730] - audio pid: 1010 language: eng type: AAC

    So it seems i have change something on TsWriter side lol
     

    Attachments

    • TVE_log_PMT.zip
      14.8 KB

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    @Sigpi007 , try attached filter version. I moved the opening code for IPTV case to Run() method, so if no data are received, then error is returned in Run() method instead of Load() method. In other words, it should not crash :)
     

    Attachments

    • Filter_P03.zip
      5.5 MB

    Users who are viewing this thread

    Top Bottom