-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Seekable streams may not always have a duration #36748
Copy link
Copy link
Closed
servo/media
#437Labels
Description
Introduced here, this causes a segfault on streams that report as seekable with no duration. an example stream like this is safetwitch which reports seekable.
doing the below simple patch to servo/media gets video working, audio cuts out after a few seconds, and sometimes it will randomly try to seek and crash the player
diff --git a/backends/gstreamer/player.rs b/backends/gstreamer/player.rs
index 1ca47c8..427a525 100644
--- a/backends/gstreamer/player.rs
+++ b/backends/gstreamer/player.rs
@@ -805,10 +805,12 @@ impl Player for GStreamerPlayer {
// if the servosrc is seekable, we should return the duration of the media
if let Some(metadata) = inner.last_metadata.as_ref() {
if metadata.is_seekable {
- return Ok(vec![Range {
- start: 0.0,
- end: metadata.duration.unwrap().as_secs_f64(),
- }]);
+ if let Some(duration) = metadata.duration {
+ return Ok(vec![Range {
+ start: 0.0,
+ end: duration.as_secs_f64(),
+ }]);
+ }
}
}
// if the servosrc is not seekable, we should return the buffered range[2025-04-29T12:15:24Z ERROR script::dom::htmlmediaelement] Player error: "Failed to seek to 0:00:32.008333326"
VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) The media playback was aborted due to a corruption problem or because the media used features your browser did not support. {"code": 3, "message": "The media playback was aborted due to a corruption problem or because the media used features your browser did not support."}
I am reporting this here since I don't know if safetwitch should even be reporting as seekable, and as the seeking issue itself, but I can move this to servo/media if wanted.
Reactions are currently unavailable