On 02/13/2015 10:29 PM, Luca Barbato wrote:

+            uint8_t *pkt_data = 0;

This should be NULL (otherwise some checker will complain).

Okay, applied.


+            for (pass = 0; pass < 2; pass++) {
+                const uint8_t *buf1 = buf;
+                int len1            = len;
+
+                while (len1 > RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE) {
+                    uint16_t nalu_size = AV_RB16(buf1);
+
+                    /* pass the NALU length field */
+                    buf1 += RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE;
+                    len1 -= RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE;
+
+                    if (nalu_size > 0 && nalu_size <= len1) {
+                        if (pass == 0) {
+ pkt_size += sizeof(start_sequence) + nalu_size;
+                        } else {
+                            /* A/V packet: copy start sequence */
+ memcpy(pkt_data, start_sequence, sizeof(start_sequence));
+                            /* A/V packet: copy NAL unit data */
+ memcpy(pkt_data + sizeof(start_sequence), buf1, nalu_size); + /* shift pointer beyond the current NAL unit */ + pkt_data += sizeof(start_sequence) + nalu_size;
+                        }
+                    }

here I'd add an else branch with the failure path or even better check directly impossible situations (nalu_size larger than the packet lenght, 0-sized nalu) and fail there.

Okay, applied.



The code itself might be better if moved to a function.


The code is a bit similar to the one of the H.264 parser. But both parser differs in the handling of "RTP_HEVC_DOND_FIELD_SIZE". At the moment, I would rather use one switch-case block than splitting it into functions.

Best regards,
Thomas.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to