From: Kostya Shishkov Date: Sun, 18 Jun 2023 14:16:54 +0000 (+0200) Subject: improve error handling in video decoding a bit X-Git-Url: https://git.nihav.org/?p=nihav-player.git;a=commitdiff_plain;h=364f01a375903b90fc9b0af001a0808249aabac3 improve error handling in video decoding a bit --- 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); }, }; }