[Live-devel] HEVC RTSP Client can only get 1/3 of the frame

Firdaus.Muhammad Firdaus.Muhammad at isapsolution.com
Fri Feb 24 07:40:02 PST 2023


Hi Mr Finlayson

Sorry just found out that you've replied question, I went through live555 mail archives trying to find some answer.


?  There is no bug in the LIVE555 code.  There is perhaps a bug in the custom code that the server uses to feed NAL units from the camera to the server.

Correct, it was only my assumption, the more I learn from mailing list, it is intended to send frames in multiple packets, you already mentioned the advantage of this from your older email.


?  What is the value of the "numTruncatedBytes" parameter to this call?  If it's >0, then this means that the supplied buffer size (the "maxSize" parameter to the call to "getNextFrame()" was too small, and needs to be increased.


This one already answered, I didn't get any error since my buffer is well above the maxSize therefore numTruncatedBytes is always 0.

Let me rephrase my problem from my findings, for older camera I get the data from getNextFrame() as follows

Nal         Remark
32           VPS
33           SPS
34           PPS
19           I-Frame (full size)
1              P-Frame (full size)
...
1              P-Frame (full size)

These I & P frames can be fed to the decoder and I can get the picture without problem.

For latest HEVC stream camera, the data will look like this
Nal         Remark
32           VPS
33           SPS
34           PPS
39           Prefix
19           I-Frame (1/3 size)
19           I-Frame (1/3 size)
19           I-Frame (1/3 size)
39           Prefix
1              P-Frame (1/3 size)
1              P-Frame (1/3 size)
1              P-Frame (1/3 size)
....
39           Prefix
1              P-Frame (1/3 size)
1              P-Frame (1/3 size)
1              P-Frame (1/3 size)
That's where I tried to merge the fragmented frames before sending it to the decoder.
I have tried to store the frame when I get Nal prefix (39) as follows on afterGetFrame function

If (firstFU){
                memcpy(temp_rtp_data, rtp_data, frameSize);
                temp_buffer_size = frameSize;
                firstFU = false;
}
else{
                size_t data_pos = 6; /// I have experiment this with many different values following hevc rfc document, still no avail
                memcpy(temp_rtp_data + temp_buffer_size, rtp_data + data_pos, frameSize - data_pos);
                temp_buffer_size += frameSize - data_pos;
                firstFU = false;
}

If I find another nal equal to 39, I send the data to the decoder, still I can only see 1/3 frame being decoded.
I have tried to find answer anywhere (including SO), but couldn't get any, there's also unanswered question regarding merging Fragmented Unit.
I am very new to video streaming world, the original code belongs to my client, I'm grateful to have a chance to learn about it.


Also pardon for my lack of netiquette from my last email, I was mindlessly replying to the email using outlook.

Best regards,
Firdaus



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20230224/68cabbe3/attachment.htm>


More information about the live-devel mailing list