Coder Social home page Coder Social logo

Comments (9)

Lynnworld avatar Lynnworld commented on June 12, 2024 1

but how about sequence reset ?

from mediasoup.

Lynnworld avatar Lynnworld commented on June 12, 2024 1

right,my mistake

from mediasoup.

ibc avatar ibc commented on June 12, 2024

Nope, that's why just above that block we check received sequence manager with SeqManager utility:

// If the wide sequence number of the new packet is lower than the latest
// seen, ignore it.
// NOTE: Not very spec compliant but libwebrtc does it.
// Also ignore if the sequence number matches the latest seen.
if (!RTC::SeqManager<uint16_t>::IsSeqHigherThan(sequenceNumber, this->latestSequenceNumber))
{
	return AddPacketResult::SUCCESS;
}

// Check if there are too many missing packets.
{
	auto missingPackets = sequenceNumber - (this->latestSequenceNumber + 1);

	if (missingPackets > FeedbackRtpTransportPacket::maxMissingPackets)
	{
		MS_WARN_DEV("RTP missing packet number exceeded");

		return AddPacketResult::FATAL;
	}
}

from mediasoup.

ibc avatar ibc commented on June 12, 2024

but how about sequence reset ?

What is sequence reset? When seq number reaches max number 65535 and next packet has seq number 0?
Well, that's exactly what RTC::SeqManager<uint16_t>::IsSeqHigherThan() cares about.

from mediasoup.

Lynnworld avatar Lynnworld commented on June 12, 2024

Yes, IsSeqHigherThan get true ,but missingPackets get wrong result.

from mediasoup.

ibc avatar ibc commented on June 12, 2024

Actually this is indeed wrong, but not sure if you are pointing to the real problem which is the usage of auto:

#include <cinttypes>  // PRIu64, etc
#include <cstddef>    // size_t
#include <cstdint>    // uint8_t, etc
#include <cstdio>

int main() {
    
    uint16_t sequenceNumber = 0;
    uint16_t latestSequenceNumber = 65535;
    
    auto missingPackets = sequenceNumber - (latestSequenceNumber + 1);
    
    printf("missingPackets: %" PRIu16 "\n", missingPackets);

    return 0;
}
missingPackets: 4294901760
#include <cinttypes>  // PRIu64, etc
#include <cstddef>    // size_t
#include <cstdint>    // uint8_t, etc
#include <cstdio>

int main() {
    
    uint16_t sequenceNumber = 0;
    uint16_t latestSequenceNumber = 65535;
    
    uint16_t missingPackets = sequenceNumber - (latestSequenceNumber + 1);
    
    printf("missingPackets: %" PRIu16 "\n", missingPackets);

    return 0;
}
missingPackets: 0

from mediasoup.

Lynnworld avatar Lynnworld commented on June 12, 2024

Not familiar with c++,But yes, auto is the real problem 👍

from mediasoup.

Lynnworld avatar Lynnworld commented on June 12, 2024

uint16 minus will overflow too

from mediasoup.

ibc avatar ibc commented on June 12, 2024

uint16 minus will overflow too

It wont. If I am wrong please be more explicit.

BTW as shown above:

#include <cinttypes>  // PRIu64, etc
#include <cstddef>    // size_t
#include <cstdint>    // uint8_t, etc
#include <cstdio>

int main() {
    
    uint16_t sequenceNumber = 0;
    uint16_t latestSequenceNumber = 65535;
    
    uint16_t missingPackets = sequenceNumber - (latestSequenceNumber + 1);
    
    printf("missingPackets: %" PRIu16 "\n", missingPackets);

    return 0;
}
missingPackets: 0

from mediasoup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.