Skip to content

Commit

Permalink
fix handling of video issues and gstreamer
Browse files Browse the repository at this point in the history
  • Loading branch information
ltn-chriskennedy committed Aug 26, 2024
1 parent 5369ffa commit 20a45c5
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/bin/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ async fn rsprobe(running: Arc<AtomicBool>) {
}
gstreamer_playing = true;
}
if args.extract_images && video_packet_errors <= 32 {
if args.extract_images {
#[cfg(feature = "gst")]
let video_packet = Arc::new(
stream_data.packet[stream_data.packet_start
Expand All @@ -1899,11 +1899,32 @@ async fn rsprobe(running: Arc<AtomicBool>) {
// If the channel is full, drop the packet
eprintln!("Video packet channel is full. Dropping packet. {} errors so far.", video_packet_errors);
video_packet_errors += 1;
/*if video_packet_errors > 32 {
eprintln!("Probe: Video packet channel has {} errors, exiting.", video_packet_errors);
running.store(false, Ordering::SeqCst);
break;
}*/
if video_packet_errors > 32 {
eprintln!("Probe: Video packet channel has {} errors, restarting Gstreamer.", video_packet_errors);
//running.store(false, Ordering::SeqCst);
//return;

// Pause Gstreamer
if gstreamer_playing == true {
eprintln!("Probe: Too many errors with gstreamer {}, pausing video images", video_packet_errors);
match pipeline.set_state(gst::State::Paused) {
Ok(_) => (),
Err(err) => {
eprintln!("Failed to set the pipeline state to Paused: {}", err);
running.store(false, Ordering::SeqCst);
return;
}
}
match pipeline.set_state(gst::State::Playing) {
Ok(_) => (),
Err(err) => {
eprintln!("Failed to set the pipeline state to Playing: {}", err);
running.store(false, Ordering::SeqCst);
return;
}
}
}
}
} else {
video_packet_errors = 0;
}
Expand Down

0 comments on commit 20a45c5

Please sign in to comment.