|
@@ -515,6 +515,8 @@ void signal_quit(int sig) {
|
515
|
515
|
int main(int argc, char **argv) {
|
516
|
516
|
ssize_t readen;
|
517
|
517
|
int have_data = 1;
|
|
518
|
+ int ntimeouts = 0;
|
|
519
|
+ time_t timeout_start = time(NULL);
|
518
|
520
|
uint8_t ts_packet[FRAME_SIZE + RTP_HDR_SZ];
|
519
|
521
|
uint8_t rtp_hdr[2][RTP_HDR_SZ];
|
520
|
522
|
int rtp_hdr_pos = 0, num_packets = 0;
|
|
@@ -585,8 +587,24 @@ int main(int argc, char **argv) {
|
585
|
587
|
}
|
586
|
588
|
}
|
587
|
589
|
set_log_io_errors(1);
|
588
|
|
- if (readen < 0)
|
|
590
|
+ if (readen < 0) {
|
589
|
591
|
ts_LOGf("--- | Input read timeout.\n");
|
|
592
|
+ if (!ntimeouts) {
|
|
593
|
+ timeout_start = time(NULL);
|
|
594
|
+ notify(&ts, "INPUT_TIMEOUT", "Read timeout on input %s://%s:%u/",
|
|
595
|
+ ts.rtp_input ? "rtp" : "udp",
|
|
596
|
+ inet_ntoa(ts.input.addr), ts.input.port);
|
|
597
|
+ }
|
|
598
|
+ ntimeouts++;
|
|
599
|
+ } else {
|
|
600
|
+ if (ntimeouts && readen > 0) {
|
|
601
|
+ notify(&ts, "INPUT_OK", "Data is available on input %s://%s:%u/ after %ld seconds timeout.",
|
|
602
|
+ ts.rtp_input ? "rtp" : "udp",
|
|
603
|
+ inet_ntoa(ts.input.addr), ts.input.port,
|
|
604
|
+ (time(NULL) - timeout_start) + 2); // Timeout is detected when ~2 seconds there is no incoming data
|
|
605
|
+ ntimeouts = 0;
|
|
606
|
+ }
|
|
607
|
+ }
|
590
|
608
|
} else {
|
591
|
609
|
readen = read(ts.input.fd, ts_packet, FRAME_SIZE);
|
592
|
610
|
have_data = !(readen <= 0);
|