Skip to content

Conversation

@GyeongHoKim
Copy link

@GyeongHoKim GyeongHoKim commented Sep 4, 2025

noVideo signal triggered in RTSPtoWeb, even though IDR-slice sent

I'm using this vdk project in a media server(RTSPtoWeb) for a web platform at construction sites.
Few weeks ago, my client says that 352x240 resolution cameras are not visible(my React WebApp uses WebRTC Player).
I finally realized that I'm experiencing exactly the same problem as issue #116, but the root cause identified by the author of that issue is incorrect.

I fixed it and it worked well on my product. The reason is below,

RTP Payloads are neither AVCC nor AnnexB format. AVCC and AnnexB is for container format

in handleVideo in format/rtspv2/demuxer.go,

nalRaw, _ := h264parser.SplitNALUs(content[client.offset:client.end])
if len(nalRaw) == 0 || len(nalRaw[0]) == 0 {
	return nil, false
}

content is RTP Packet and client.offset is 12 byte(RTP Hdr size).
SplitNALUs assumes that content[client.offset:client.end] is in either AVCC or AnnexB format
However, RTP Payloads are neither AVCC nor AnnexB format.

Because RTP payloads lack Emulation Prevention, SplitNALUs may incorrectly fragment what is actually a single, complete NAL unit.

so, in handleH264Payload,

retmap = client.appendVideoPacket(retmap, nal, naluType == 5)

it leads to IsKeyFrame to be false

Resolves #116

- Remove backup files server.go_
- go mod tidy to clean up dependencies
- Add missing H264 NALuType definition we need
- Fix inconsistently named H265 NALuType values, especially AP and FU
- AnnexB/AVCC are container formats unrelated to RTP packetization,
deleted SplitNALus in the RTPDemuxing logic.
- Added H264 STAP-B packetization mode handler
- Implements proper handling of RTP video packets according to RFC
standards:

https://datatracker.ietf.org/doc/html/rfc6184#section-5.7
https://datatracker.ietf.org/doc/html/rfc7798#section-4.4.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtspv2 Client Incorrectly Sets IsKeyFrame=false for IDR Slices (NALU Type 5) when Using Length-Prefixed Output

1 participant