diff --git a/pkg/h264/rtp.go b/pkg/h264/rtp.go index 08e61a78..6044caae 100644 --- a/pkg/h264/rtp.go +++ b/pkg/h264/rtp.go @@ -75,11 +75,8 @@ func RTPDepay(track *streamer.Track) streamer.WrapperFunc { // https://github.com/AlexxIT/WebRTC/issues/391 // https://github.com/AlexxIT/WebRTC/issues/392 for i := 0; i < len(payload); { - switch NALUType(payload[i:]) { - case NALUTypeSPS, NALUTypePPS, NALUTypeIFrame, NALUTypePFrame: - default: - payload = payload[:i] - continue + if i+4 >= len(payload) { + break } size := bytes.Index(payload[i+4:], []byte{0, 0, 0, 1}) @@ -89,6 +86,7 @@ func RTPDepay(track *streamer.Track) streamer.WrapperFunc { } size = len(payload) - (i + 4) } + binary.BigEndian.PutUint32(payload[i:], uint32(size)) i += size + 4 diff --git a/www/video-rtc.js b/www/video-rtc.js index 0bb9e471..e04d5b66 100644 --- a/www/video-rtc.js +++ b/www/video-rtc.js @@ -395,11 +395,11 @@ export class VideoRTC extends HTMLElement { bufLen = 0; sb.appendBuffer(data); } else if (sb.buffered && sb.buffered.length) { - const end = sb.buffered.end(sb.buffered.length - 1) - 5; + const end = sb.buffered.end(sb.buffered.length - 1) - 15; const start = sb.buffered.start(0); if (end > start) { sb.remove(start, end); - ms.setLiveSeekableRange(end, end + 5); + ms.setLiveSeekableRange(end, end + 15); } // console.debug("VideoRTC.buffered", start, end); }