Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add PIDs before we see PMT #27

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/bin/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ impl StreamData {
data: packet.to_vec(),
}
}
fn update_stream_type(&mut self, stream_type: String) {
self.stream_type = stream_type;
}
fn update_stats(&mut self, packet_size: usize, arrival_time: u64) {
let bits = packet_size as u64 * 8; // Convert bytes to bits

Expand Down Expand Up @@ -258,7 +261,9 @@ fn process_packet(stream_data_packet: &StreamData, errors: &mut Tr101290Errors)
error!("ProcessPacket: PID {} not found in PID map.", pid);
}
}
if !found_pid && pid == 0x1FFF {

// PID not found, add the stream_data_packet to the pid_map, probably before we have seen the PMT
if !found_pid {
// PID not found, add the stream_data_packet to the pid_map
pid_map.insert(
pid,
Expand Down Expand Up @@ -520,6 +525,8 @@ fn update_pid_map(pmt_packet: &[u8]) {
let stream_data = pid_map.get_mut(&stream_pid).unwrap();
// update the timestamp
stream_data.update_stats(pmt_packet.len(), timestamp);
// update the stream type
stream_data.update_stream_type(stream_type.to_string());

// create json object of stats
let json_stats = json!({
Expand Down