roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.05k stars 205 forks source link

Raptor/RaptorQ FEC scheme #236

Open gavv opened 5 years ago

gavv commented 5 years ago

Intro

It would be interesting to try Raptor/RaptorQ FEC codes. It is claimed that they perform better than Reed-Solomon.

Our docs:

RFCs:

Known Raptor/RaptorQ implementations:

Implementation

We should try libRaptorQ.

The plan is:

Steps

This could be split into three pull requests:

  1. Add libRaptorQ dependency. Add raptor encoder and decoder. Enable them in codec-level roc_fec tests.

  2. Add support for bare-RTP source & repair packets in fec::Reader and fec::Writer (without FECFRAME header). Add corresponding unit tests.

  3. Register raptor FEC scheme. Add it to command-line tools and C API. Add it to reader-writer-level roc_fec tests and roc_pipeline & roc_lib tests.

drdpov commented 4 years ago

Hi @gavv. Is this issue still open? Can I work with it? What should i start with?

gavv commented 4 years ago

Hi! Yes, this is still relevant and you're welcome.

I'd recommend to start from reading this page from our documentation and then RFC 6363, RFC 6681, and RFC 6682.

Then I suggest to look at OpenRQ and orq. IIRC, OpenRQ is quite complete, but it's written in Java. I don't know whether orq is complete. So you'll need to do some research. If we can just use orq, it would be great! If it's far from complete, we'll have either to send patches or to grow our own implementation, likely using OpenRQ and orq as a reference.

We already have generic FECFRAME code and tests. We support two FEC schemes (LDPC and Reed-Solomon). In command-line tools FEC scheme is auto-detected from port protocols (e.g. rs8m protocol corresponds to Reed-Solomon scheme). See manual pages for info on how to try different schemes. You can play with them and see how they behave on different block sizes and packet loss ratios. This post may be helpful.

In this task we should add raptor-specific payload format and encoder/decoder. ~For payload format, look at the roc_fec/headers.h, used in fec::Parser and fec::Composer.~ For codecs, look at fec::OFEncoder and fec::OFDecoder (LDPC and Reed-Solomon encoder & decoder implemented using OpenFEC). Then we should integrate the new scheme into pipeline and add corresponding FEC scheme. Finally, it would be interesting to compare Raptor with existing schemes in terms of latency and service quality.

gavv commented 4 years ago

Oh, and there are also:

gavv commented 4 years ago

I've took a look at those libraries and I think libRaptorQ looks very promising and we should try it first (its C++98 or C API).

I've also updated the issue and added a more detailed plan. And I've removed the part about fec::Parser/fec::Composer - we actually don't need a new parser & composer for Raptor because it doesn't introduce new headers, only a new RTP payload.

@ffisherr What do you think? Are you working on this / have plans to work on this?

drdpov commented 4 years ago

Hey @gavv, agree with you, example in libRaptorQ seems very easy, i believe, i can do the first pull request in couple days.

gavv commented 4 years ago

Great!

drdpov commented 4 years ago

Hey, i have some troubles while adding libRaptorQ to SConstruct file. Here it is: /usr/local/include/RaptorQ/v1/caches.hpp:24:10: fatal error: vector: No such file or directory

include

How can i solve that? I saw in coding guidelines: "We don’t use STL (the algorithms-and-containers part of the C++ standard library)." Anyway, it is used in libraptoq.

gavv commented 4 years ago

We don't use STL, but we don't disable it in any way. So the error is unrelated. It's OK if libraptorq uses STL, we just wont be able to enable raptor on some restricted platforms.

gavv commented 4 years ago

You can push your changes to a branch on your fork and I'll take a look at it.

drdpov commented 4 years ago

Done.

gavv commented 4 years ago

Have you tried to remove extern "C" when including libraptorq headers?

drdpov commented 4 years ago

In "rq_encoder.h" #include <RaptorQ/RaptorQ_v1.hpp>? Yes, still doesn't work..

gavv commented 4 years ago

Well, I can't reproduce the error with <vector>, probably we have different compiler versions. But I got lots of other errors on your branch:

One option would be to modify our build system to use c++11/c++17 for raptor codecs, but I'd like to avoid mixing different C++ standards for different translation units, it can lead to various linking problems.

Can we just use libraptorq pure C API instead?

BTW, for extensive discussions/debugging/etc I recommend to use our mailing list.

gavv commented 4 years ago

@ffisherr Do you still have plans on this?

gavv commented 4 years ago

Unassigning this so that someone else could pick it up. @ffisherr feel free to ping me if you decide to come back.

If somebody will pick this up, please take a look at these discussion at the mailing list:

https://www.freelists.org/post/roc/libRaptorQ https://www.freelists.org/post/roc/roc-Re-libRaptorQ

gavv commented 11 months ago

The task is old but still relevant. We should check what is current status of libRaptorQ.