Fix hevc decode error "Could not find ref with POC" (#9960)

1. Dropping frames can cause this error, reset encoder when this
   happens.
2. There are some logic error for clear video queue, because video queue
   message is not cleared. This need to be fixed.

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-11-18 23:03:27 +08:00
committed by GitHub
parent 8b710f62c8
commit c5426b0fbc
4 changed files with 28 additions and 5 deletions

View File

@@ -2417,6 +2417,24 @@ where
// to-do: fix the error
log::error!("handle video frame error, {}", e);
session.refresh_video(display as _);
#[cfg(feature = "hwcodec")]
if format == CodecFormat::H265 {
if let Some(&scrap::hwcodec::ERR_HEVC_POC) =
e.downcast_ref::<i32>()
{
for (i, handler_controler) in
handler_controller_map.iter_mut()
{
if *i != display
&& handler_controler.handler.decoder.format()
== CodecFormat::H265
{
log::info!("refresh video {} due to hevc poc not found", i);
session.refresh_video(*i as _);
}
}
}
}
}
_ => {}
}

View File

@@ -1146,9 +1146,13 @@ impl<T: InvokeUiSession> Remote<T> {
.ok();
} else {
if let Some(video_queue) = video_queue_write.get_mut(&display) {
video_queue.force_push(vf);
if video_queue.force_push(vf).is_some() {
while let Some(_) = video_queue.pop() {}
self.handler.refresh_video(display as _);
} else {
self.video_sender.send(MediaData::VideoQueue(display)).ok();
}
}
self.video_sender.send(MediaData::VideoQueue(display)).ok();
}
self.fps_control
.last_active_time