From 19a83e1b2cbac94b9dfc75cc735210215fc57d1f Mon Sep 17 00:00:00 2001 From: Yesterday17 Date: Sun, 3 Sep 2023 23:34:20 +0800 Subject: [PATCH] feat(playback): report error with log --- anni-playback/src/decoder/decoder.rs | 12 ++++++------ anni-playback/src/sources/hls.rs | 4 ++-- anni-playback/src/sources/http.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/anni-playback/src/decoder/decoder.rs b/anni-playback/src/decoder/decoder.rs index ff1a842..eb538b3 100644 --- a/anni-playback/src/decoder/decoder.rs +++ b/anni-playback/src/decoder/decoder.rs @@ -104,8 +104,8 @@ impl Decoder { pub fn start(mut self) { loop { // Check if the preload thread is done. - if self.poll_preload_thread().is_err() { - // update_callback_stream(Callback::DecodeError); + if let Err(e) = self.poll_preload_thread() { + log::error!("Decode error on poll_preload_thread: {e}"); } // Check for incoming `ThreadMessage`s. @@ -115,8 +115,8 @@ impl Decoder { break; } } - Err(_) => { - // update_callback_stream(Callback::DecodeError); + Err(e) => { + log::error!("Decode error on listen_for_message: {e}"); } } @@ -132,8 +132,8 @@ impl Decoder { } _ => (), }, - Err(_) => { - // update_callback_stream(Callback::DecodeError); + Err(e) => { + log::error!("Decode error on do_playback: {e}"); } } } diff --git a/anni-playback/src/sources/hls.rs b/anni-playback/src/sources/hls.rs index 426b346..13297d0 100644 --- a/anni-playback/src/sources/hls.rs +++ b/anni-playback/src/sources/hls.rs @@ -201,8 +201,8 @@ impl Read for HlsStream { thread::spawn(move || { let result = Self::read_chunk(tx, url, start, file_size); - if result.is_err() { - // update_callback_stream(Callback::NetworkStreamError) + if let Err(e) = result { + log::error!("Network stream error on hls::read_chunk : {e}"); } }); diff --git a/anni-playback/src/sources/http.rs b/anni-playback/src/sources/http.rs index 850b827..1b2c675 100644 --- a/anni-playback/src/sources/http.rs +++ b/anni-playback/src/sources/http.rs @@ -210,8 +210,8 @@ impl Read for HttpStream { thread::spawn(move || { let result = Self::read_chunk(tx, url, chunk_write_pos, file_size); - if result.is_err() { - // update_callback_stream(Callback::NetworkStreamError) + if let Err(e) = result { + log::error!("Network stream error on http::read_chunk : {e}"); } }); }