Second fix for Chinese buggy cameras

This commit is contained in:
Alexey Khit
2023-01-24 21:38:58 +03:00
parent c43530fbd3
commit 9bbaf41d54
2 changed files with 5 additions and 7 deletions
+3 -5
View File
@@ -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
+2 -2
View File
@@ -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);
}