# HG changeset patch # User Mychaela Falconia # Date 1688849249 0 # Node ID 9b0613775cf62cf0d9605bc8eb1b89337853a282 # Parent 709aa9ad72d1643a5b89d7381771a72ae93712fa rtp-g711-extr: add ability to skip some number of packets, effectively starting the process at packet N rather than packet 0 diff -r 709aa9ad72d1 -r 9b0613775cf6 rtp-g711-extr.c --- a/rtp-g711-extr.c Sat Jul 08 20:30:33 2023 +0000 +++ b/rtp-g711-extr.c Sat Jul 08 20:47:29 2023 +0000 @@ -155,11 +155,11 @@ char errbuf[PCAP_ERRBUF_SIZE]; u_char *pkt; struct pcap_pkthdr pkthdr; - unsigned pkt_idx; + unsigned pkt_idx, skip_num; - if (argc != 6) { + if (argc < 6 || argc > 7) { fprintf(stderr, - "usage: %s pcap-file src|dest ip-addr udp-port outfile\n", + "usage: %s pcap-file src|dest ip-addr udp-port outfile [skip-count]\n", argv[0]); exit(1); } @@ -191,10 +191,16 @@ perror(argv[5]); exit(1); } + if (argv[6]) + skip_num = strtoul(argv[6], 0, 0); + else + skip_num = 0; for (pkt_idx = 0; ; pkt_idx++) { pkt = pcap_next(pcap, &pkthdr); if (!pkt) break; + if (pkt_idx < skip_num) + continue; process_packet(pkt, (unsigned) pkthdr.caplen, pkt_idx); } if (!stream_init_flag) {