We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26e9424 commit 0dc117cCopy full SHA for 0dc117c
crates/rendering/src/decoder/mod.rs
@@ -456,11 +456,21 @@ pub struct AsyncVideoDecoderHandle {
456
}
457
458
impl AsyncVideoDecoderHandle {
459
- const NORMAL_TIMEOUT_MS: u64 = 2000;
460
const INITIAL_SEEK_TIMEOUT_MS: u64 = 10000;
461
+ fn normal_timeout_ms(&self) -> u64 {
462
+ let pixels = (self.status.video_width as u64) * (self.status.video_height as u64);
463
+ if pixels > 4_000_000 {
464
+ 4000
465
+ } else if pixels > 2_000_000 {
466
+ 3000
467
+ } else {
468
+ 2000
469
+ }
470
471
+
472
pub async fn get_frame(&self, time: f32) -> Option<DecodedFrame> {
- self.get_frame_with_timeout(time, Self::NORMAL_TIMEOUT_MS)
473
+ self.get_frame_with_timeout(time, self.normal_timeout_ms())
474
.await
475
476
0 commit comments