Browse Source

Fixes for recording packet counter

- The packet counter was accidentally a pointer, resulting in it
  incrementing by 8 instead of 1. That is fixed.
- Use proper formatting macro for uint64_t printing.
- Start PCAP packet indexing at 1 since that is what Wireshark does.
pull/245/head
Dylan Mikus 10 years ago
committed by Eric Green
parent
commit
fa8146f053
3 changed files with 7 additions and 8 deletions
  1. +1
    -3
      daemon/media_socket.c
  2. +5
    -4
      daemon/recording.c
  3. +1
    -1
      daemon/recording.h

+ 1
- 3
daemon/media_socket.c View File

@ -21,8 +21,6 @@
#include "recording.h"
#ifndef PORT_RANDOM_MIN
#define PORT_RANDOM_MIN 6
#define PORT_RANDOM_MAX 20
@ -1202,7 +1200,7 @@ loop_ok:
// If recording pcap dumper is set, then we record the call.
if (recording_pdumper != NULL && call->record_call) {
stream_pcap_dump(recording_pdumper, stream, s);
call->recording->packet_num += 1;
call->recording->packet_num++;
}
if (handler_ret >= 0) {


+ 5
- 4
daemon/recording.c View File

@ -6,10 +6,10 @@
#include <sys/stat.h>
#include <netinet/in.h>
#include <time.h>
#include "call.h"
#include <pcap.h>
#include <curl/curl.h>
#include <inttypes.h>
#include "call.h"
int maybe_create_spool_dir(char *dirpath);
@ -136,7 +136,8 @@ int set_record_call(struct call *call, str recordcall) {
call->recording = g_slice_alloc0(sizeof(struct recording));
call->recording->recording_pd = NULL;
call->recording->recording_pdumper = NULL;
call->recording->packet_num = 0;
// Wireshark starts at packet index 1, so we start there, too
call->recording->packet_num = 1;
meta_setup_file(call->recording, call->callid);
}
} else if (!str_cmp(&recordcall, "no")) {
@ -219,7 +220,7 @@ ssize_t meta_write_sdp(FILE *meta_fp, struct iovec *sdp_iov, int iovcnt,
} else {
fprintf(meta_fp, "other");
}
fprintf(meta_fp, "\nSDP before RTP packet: %llu\n\n", packet_num);
fprintf(meta_fp, "\nSDP before RTP packet: %" PRIu64 "\n\n", packet_num);
fflush(meta_fp);
return writev(meta_fd, sdp_iov, iovcnt);
}


+ 1
- 1
daemon/recording.h View File

@ -20,7 +20,7 @@ struct recording {
str *metadata;
pcap_t *recording_pd;
pcap_dumper_t *recording_pdumper;
uint64_t *packet_num;
uint64_t packet_num;
str *recording_path;
};


Loading…
Cancel
Save