On Wed, 4 Mar 2015, Thomas Volkert wrote:

On 03/03/2015 10:13 AM, Martin Storsjö wrote:
On Tue, 3 Mar 2015, Thomas Volkert wrote:

+ /* sanity check for markers: B should always be equal to the RTP M marker */
+    if (last_fragment >> 2 != flags & RTP_FLAG_MARKER) {

This kinda hardcodes the value of RTP_FLAG_MARKER in a quite fragile way. (If someone every were to change the value of RTP_FLAG_MARKER, nobody would notice that this check needs to be updated, and this would break.) What about this instead:

Okay, I see, we can improve this.
But I wouldn't expect a change for the definition of RTP_FLAG_MARKER (or the RTP rfc).

The RTP RFC won't of course change, but RTP_FLAG_MARKER doesn't have the same value as that one. See rtpdec.h and rtpdec.c:

#define RTP_FLAG_KEY    0x1 ///< RTP packet contains a keyframe
#define RTP_FLAG_MARKER 0x2 ///< RTP marker bit was set for this packet

    if (buf[1] & 0x80)
        flags |= RTP_FLAG_MARKER;


So the flag that is fixed in the protocol spec (in the RFC) which cannot reasonably change is 0x80 in the second byte of the RTP header. While the constants used within the rtpdec subsystem is our own namespace of flags, where the value currently is 2, but we could choose to reorganize them if we wanted to. (Like, there's nothing in the RTP header spec about RTP_FLAG_KEY, that's just an extra flag that we use in some depacketizers.)

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to