mirakc / mirakc-arib

mirakc-tools for Japanese TV broadcast contents
Apache License 2.0
24 stars 6 forks source link

time_limit for collect-eits doesn't work correctly #4

Closed masnagam closed 4 years ago

masnagam commented 4 years ago

A snippet from mirakc log:

 2020-02-09T02:39:01.750Z INFO  mirakc::tuner                 > tuner#2: Activate with GR 26
 2020-02-09T02:39:01.760Z DEBUG mirakc::tuner                 > tuner#2.68: Spawned 68: `recpt1 --device /dev/px4video6 26 - -`
 2020-02-09T02:39:01.761Z INFO  mirakc::tuner                 > tuner#2.68: Activated with GR 26
 2020-02-09T02:39:01.762Z INFO  mirakc::tuner                 > tuner#2.68.1: Subscribed: Job(eit-collector) (priority=-1)
 2020-02-09T02:39:01.762Z DEBUG mirakc::broadcaster           > tuner#2.68: Started
 2020-02-09T02:39:01.763Z INFO  mirakc::tuner                 > tuner#2.68.1: Started streaming
using device: /dev/px4video6
pid = 68
 2020-02-09T02:39:01.783Z DEBUG mirakc::command_util          > tuner#2.68.1: Spawned 69: `mirakc-arib collect-eits --sids=1032 --sids=1033 --sids=1034`
...
[2020-02-09 02:40:01.902] [collect-eits] [info] EIT: onid(7FE1) tsid(7FE1) sid(0408) tid(0059/59) sec(50:51/F8) ver(07)
[2020-02-09 02:40:03.394] [collect-eits] [info] TOT: 2020/02/09 11:40:04.000
[2020-02-09 02:40:08.372] [collect-eits] [info] TOT: 2020/02/09 11:40:09.000
[2020-02-09 02:40:13.416] [collect-eits] [info] TOT: 2020/02/09 11:40:14.000
[2020-02-09 02:40:18.392] [collect-eits] [info] TOT: 2020/02/09 11:40:19.000
[2020-02-09 02:40:23.366] [collect-eits] [info] TOT: 2020/02/09 11:40:24.000
[2020-02-09 02:40:28.413] [collect-eits] [info] TOT: 2020/02/09 11:40:29.000
[2020-02-09 02:40:33.389] [collect-eits] [info] TOT: 2020/02/09 11:40:34.000
[2020-02-09 02:40:38.433] [collect-eits] [info] TOT: 2020/02/09 11:40:39.000
...

The defualt time_limit is 30s, but the command never terminates after timeout...

masnagam commented 4 years ago

At least the --time-limit option works fine:

$ recpt1 --device /dev/px4video7 26 - - 2>/dev/null | MIRAKC_ARIB_LOG=info \
    mirakc-arib collect-eits --sids=1032 --sids=1033 --sids=1034 --time-limit=0
[2020-02-09 06:02:25.049] [collect-eits] [info] Read packets from STDIN...
[2020-02-09 06:02:25.050] [collect-eits] [info] --sids SIDs: 1032, 1033, 1034
[2020-02-09 06:02:25.050] [collect-eits] [info] --xsids SIDs:
[2020-02-09 06:02:25.050] [collect-eits] [info] Time-Limit: 0
[2020-02-09 06:02:25.050] [collect-eits] [info] Feed packets...
[2020-02-09 06:02:25.800] [collect-eits] [error] Timed out
[2020-02-09 06:02:25.800] [collect-eits] [info] Collected 0 services, 0 sections, 0:00.750 elapsed
[2020-02-09 06:02:25.800] [collect-eits] [info] Ended to feed packets unsuccessfully
masnagam commented 4 years ago

Ugh!

modified   src/eit_collector.hh
@@ -885,7 +885,7 @@ class EitCollector final : public PacketSink,
   }

   inline bool CheckTimeout() const {
-    auto elapsed = last_updated_ - timestamp_;
+    auto elapsed = timestamp_ - last_updated_;
     return elapsed >= option_.time_limit;
   }