Browse Source

Log message when there is not data on input.

Georgi Chorbadzhiyski 13 years ago
parent
commit
0070a7c679
2 changed files with 8 additions and 2 deletions
  1. 1
    1
      libfuncs
  2. 7
    1
      tsdecrypt.c

+ 1
- 1
libfuncs

1
-Subproject commit f68888b2d07d55acaafc9882c8e06162e882e263
1
+Subproject commit 82141bd7b73677f69b11dabd131de95b50e6be6e

+ 7
- 1
tsdecrypt.c View File

389
 
389
 
390
 int main(int argc, char **argv) {
390
 int main(int argc, char **argv) {
391
 	ssize_t readen;
391
 	ssize_t readen;
392
+	int have_data = 1;
392
 	uint8_t ts_packet[FRAME_SIZE + RTP_HDR_SZ];
393
 	uint8_t ts_packet[FRAME_SIZE + RTP_HDR_SZ];
393
 	uint8_t rtp_hdr[2][RTP_HDR_SZ];
394
 	uint8_t rtp_hdr[2][RTP_HDR_SZ];
394
 	int rtp_hdr_pos = 0, num_packets = 0;
395
 	int rtp_hdr_pos = 0, num_packets = 0;
432
 	camd_start(&ts);
433
 	camd_start(&ts);
433
 	do {
434
 	do {
434
 		if (ts.input.type == NET_IO) {
435
 		if (ts.input.type == NET_IO) {
436
+			set_log_io_errors(0);
435
 			if (!ts.rtp_input) {
437
 			if (!ts.rtp_input) {
436
 				readen = fdread_ex(ts.input.fd, (char *)ts_packet, FRAME_SIZE, 250, 4, 1);
438
 				readen = fdread_ex(ts.input.fd, (char *)ts_packet, FRAME_SIZE, 250, 4, 1);
437
 			} else {
439
 			} else {
450
 					num_packets++;
452
 					num_packets++;
451
 				}
453
 				}
452
 			}
454
 			}
455
+			set_log_io_errors(1);
456
+			if (readen < 0)
457
+				ts_LOGf("--- | Input read timeout.\n");
453
 		} else {
458
 		} else {
454
 			readen = read(ts.input.fd, ts_packet, FRAME_SIZE);
459
 			readen = read(ts.input.fd, ts_packet, FRAME_SIZE);
460
+			have_data = !(readen <= 0);
455
 		}
461
 		}
456
 		if (readen > 0)
462
 		if (readen > 0)
457
 			process_packets(&ts, ts_packet, readen);
463
 			process_packets(&ts, ts_packet, readen);
458
 		if (!keep_running)
464
 		if (!keep_running)
459
 			break;
465
 			break;
460
-	} while (readen > 0);
466
+	} while (have_data);
461
 EXIT:
467
 EXIT:
462
 	camd_stop(&ts);
468
 	camd_stop(&ts);
463
 
469
 

Loading…
Cancel
Save