From 364f01a375903b90fc9b0af001a0808249aabac3 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 18 Jun 2023 16:16:54 +0200 Subject: [PATCH] improve error handling in video decoding a bit --- videoplayer/src/videodec.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/videoplayer/src/videodec.rs b/videoplayer/src/videodec.rs index d30f45f..1d70112 100644 --- a/videoplayer/src/videodec.rs +++ b/videoplayer/src/videodec.rs @@ -113,17 +113,20 @@ impl VideoDecoder { }, (Err(err), id) => { reord.drop_frame(id); - panic!("frame {} decoding error {:?}", id, err); + println!("frame {} decoding error {:?}", id, err); }, }; } match vdec.queue_pkt(&mut self.dec.dsupp, &pkt, queue_id) { Ok(true) => {}, - Ok(false) => panic!("still can't queue frame!"), - Err(err) => panic!("queueing error {:?}", err), + Ok(false) => { + println!("still can't queue frame!"); + VDEC_STATE.set_state(DecodingState::Error); + }, + Err(err) => println!("queueing error {:?}", err), }; }, - Err(err) => panic!("queueing error {:?}", err), + Err(err) => println!("queueing error {:?}", err), }; while let Some(frm) = reord.get_frame() { let bt = frm.get_buffer(); @@ -156,7 +159,7 @@ impl VideoDecoder { }, (Err(err), id) => { reord.drop_frame(id); - panic!("frame {} decoding error {:?}", id, err); + println!("frame {} decoding error {:?}", id, err); }, }; } @@ -168,7 +171,7 @@ impl VideoDecoder { (Err(DecoderError::NoFrame), _) => {}, (Err(err), id) => { reord.drop_frame(id); - panic!("frame {} decoding error {:?}", id, err); + println!("frame {} decoding error {:?}", id, err); }, }; } -- 2.39.5