File tree 2 files changed +24
-1
lines changed
crates/utils/re_video/src/decode
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -884,7 +884,10 @@ impl AsyncDecoder for FFmpegCliH264Decoder {
884
884
}
885
885
886
886
fn min_num_samples_to_enqueue_ahead ( & self ) -> usize {
887
- // TODO: describe this and add ticket.
887
+ // TODO(#8848): On some videos (which??) we need to enqueue more samples, otherwise ffmpeg will not provide us with any frames.
888
+ // The observed behavior is that we continously get frames that are 16 frames older than what we enqueued,
889
+ // never reaching the frames of all currently enqueued GOPs prior.
890
+ // (The same happens with webcodec decoder on Safari for affected videos)
888
891
16
889
892
}
890
893
}
Original file line number Diff line number Diff line change @@ -190,8 +190,28 @@ impl AsyncDecoder for WebVideoDecoder {
190
190
191
191
Ok ( ( ) )
192
192
}
193
+
194
+ fn min_num_samples_to_enqueue_ahead ( & self ) -> usize {
195
+ // TODO(#8848): For some h264 videos (which??) we need to enqueue more samples, otherwise Safari will not provide us with any frames.
196
+ // (The same happens with FFmpeg-cli decoder for the affected videos)
197
+ if self . video_config . is_h264 ( ) && IS_SAFARI . get ( ) {
198
+ {
199
+ 16 // Safari needs more samples queued for h264
200
+ } else {
201
+ // No such workaround are needed anywhere else,
202
+ // GOP boundaries as handled by the video player are enough.
203
+ 0
204
+ }
205
+ }
193
206
}
194
207
208
+ const IS_SAFARI : Lazy < bool > = Lazy :: new ( || {
209
+ web_sys:: window ( )
210
+ . and_then ( |w| w. navigator ( ) . user_agent ( ) . ok ( ) )
211
+ . map ( |ua| ua. contains ( "Safari" ) )
212
+ . unwrap_or ( false )
213
+ } ) ;
214
+
195
215
fn init_video_decoder (
196
216
on_output_callback : Arc < OutputCallback > ,
197
217
timescale : Timescale ,
You can’t perform that action at this time.
0 commit comments