Reputation: 1
I publish in unity and play it on the web. If the player starts before the publisher, the video and audio can be obtained, but the video disappears after refreshing the page. If the publisher starts before the player, the receiver only has audio and video cannot be obtained. The above results have been verified by chrome://webrtc-internals/ . This is not in line with the normal process. Is it a bug?
I try to wait for a while after publishing, then playing, the video still doesn't work.
Upvotes: 0
Views: 215
Reputation: 1424
That's because your encoder doesn't response the PLI request, please see this issue for example.
For NVCodec, you have to set a flag to encode the keyframe with SPS/PPS, like this PR:
picParams.encodePicFlags = NV_ENC_PIC_FLAG_FORCEINTRA | NV_ENC_PIC_FLAG_FORCEIDR
| NV_ENC_PIC_FLAG_OUTPUT_SPSPPS;
The sequence header is SPS/PPS for H.264, or SPS/PPS/VPS for H.265, it's just a short name.
If not set the flag, you might get an error avc ignore type=1 for no sequence header
. No sequence header means no SPS/PPS, so it's not able to decode the video stream.
The NV_ENC_PIC_FLAG_OUTPUT_SPSPPS
should be set when encoder generate a IDR frames(generally keyframes). And for WebRTC, a keyframe also be sent with SPS/PPS, because the SPS/PPS might change.
Upvotes: 0