diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-12-04 14:53:54 +0100 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-12-04 14:53:54 +0100 | 
| commit | c89b5e3c0d9515f07892af464bd6c60fb3427c36 (patch) | |
| tree | 18c7573859606dada82e56d5115cd5d1e71129db /src/odr-sourcecompanion.cpp | |
| parent | 814ec3abaede73ea38c7130333c7bc0a18e05d91 (diff) | |
| download | ODR-SourceCompanion-c89b5e3c0d9515f07892af464bd6c60fb3427c36.tar.gz ODR-SourceCompanion-c89b5e3c0d9515f07892af464bd6c60fb3427c36.tar.bz2 ODR-SourceCompanion-c89b5e3c0d9515f07892af464bd6c60fb3427c36.zip | |
Timestamp arrival of UDP packets
Diffstat (limited to 'src/odr-sourcecompanion.cpp')
| -rw-r--r-- | src/odr-sourcecompanion.cpp | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/src/odr-sourcecompanion.cpp b/src/odr-sourcecompanion.cpp index 02475eb..b8c5547 100644 --- a/src/odr-sourcecompanion.cpp +++ b/src/odr-sourcecompanion.cpp @@ -323,10 +323,6 @@ int main(int argc, char *argv[])          }      } -    if (not edi_output_uris.empty()) { -        edi_output.set_tist(tist_enabled, tist_delay_ms); -    } -      if (padlen != 0) {          int flags;          if (mkfifo(pad_fifo, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH) != 0) { @@ -436,14 +432,21 @@ int main(int argc, char *argv[])                  }              } -            numOutBytes = avtinput.getNextFrame(outbuf); -            if (numOutBytes == 0) { +            chrono::system_clock::time_point ts; +            numOutBytes = avtinput.getNextFrame(outbuf, ts); +            if (numOutBytes > 0) { +                if (not edi_output_uris.empty()) { +                    edi_output.set_tist(tist_enabled, tist_delay_ms, ts); +                } +            } +            else {                  const auto curTime = std::chrono::steady_clock::now();                  const auto diff = curTime - timeout_start;                  if (diff > timeout_duration) {                      fprintf(stderr, "timeout reached\n");                      timedout = true; -                } else { +                } +                else {                      const int wait_ms = 1;                      usleep(wait_ms * 1000);                  } | 
