• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    C
  • License
    GNU Lesser Genera...
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ffrdp is a fast reliable protocol base on udp + arq + fec.
ffrdp 是一个基于 udp + arq + fec 的快速可靠协议

(500 行代码实现了完整的 udp + arq + fec,简洁高效。github 上目前还找不到更简洁的)

livedesk + fanplayer 使用 ffrdp 实现了 100ms 以内低延迟的 wifi 无线音视频实时传输


rto 计算:
初始:
rtts = rttm;
rttd = rttm / 2;

迭代:
rtts = (1 - alpha) * rtts + alpha * rttm; // alpha = 1 / 8
rttd = (1 - beta ) * rttd + beta  * abs(rttm - rtts); // beta = 1 / 4

正常:
rto  = rtts + r * rttd;

超时:
rto  = 1.5 * rto;


帧定义:
data frame:
data_full  frame: 0x00 seq0 seq1 seq2 data ...
data_short frame: 0x01 seq0 seq1 seq2 data ...
data_fec2  frame: 0x02 seq0 seq1 seq2 data ... fec_seq0 fec_seq1
data_fec3  frame: 0x03 seq0 seq1 seq2 data ... fec_seq0 fec_seq1
data_fec4  frame: 0x04 seq0 seq1 seq2 data ... fec_seq0 fec_seq1
... ...
data_fec32 frame: 0x3E seq0 seq1 seq2 data ... fec_seq0 fec_seq1

ack   frame: 0x40 una0 una1 una2 mack0 mack1 mack2 rwnd
query frame: 0x41

data_full  frame 为不带 fec 的 data 长帧
data_short frame 为不带 fec 的 data 短帧
data_fecN 为每 N 帧带一个 fec 帧(N >= 2 && N <= 32)


协议特点:
选择重传、快速重传、非延迟 ACK、UNA + MACK、非退让流控、FEC 前向纠错


协议说明:
seq una 长度为 24bit,recv_win_size 为 16bit
ack 帧包含了 una, mack 和 rwnd size 信息
mack 24bit 是一个 bitmap, 包含了 una 之后,但又已经被 ack 的帧号
query 命令用于查询 ack
fec_seq 长度为 16bit 用于 FEC

例如:una: 16, mack: 0x000003 这个应答代表
ack 1  1  1  1  0  1  1  0  0  0  0
seq 12 13 14 15 16 17 18 19 20 21 22 ...
这些帧已经被接收方收到并应答

una+mack 的方式被用于选择重传和快速重传


FEC 说明:
采用异或方式实现 FEC
针对 full frame 即帧长度为 MTU 的帧,进行 FEC 纠错
data frame 的最后两个字节用作 FEC 的 seq.


rockcarry
2020-9-1



More Repositories

1

fanplayer

A portable video player based on ffmpeg for windows and android platform.
C
605
star
2

ffplayer

a video player based on ffmpeg for win32 and android platform.
C
274
star
3

ffjpeg

a simple jpeg codec.
C
106
star
4

ffcnn

ffcnn is a cnn neural network inference framework, written in 600 lines C language.
C
75
star
5

v4l2test

v4l2 camera test for android platform.
C
66
star
6

ffnes

this is a nes emulator
C
51
star
7

cube

implement a simple algorithm to solve Rubik's Cube.
C
46
star
8

ffmp4muxer

C
44
star
9

LiveDesk

win32 livedesk rtsp server, rtmp pusher, screen recorder, avkcp server, ffrdp server.
C
34
star
10

ffvm

a riscv32 rv32imc emulator written in c.
C
31
star
11

ffhttpd

a simple http server
HTML
31
star
12

tinygl

C
28
star
13

games

C
25
star
14

ping

C
25
star
15

ffavimuxer

C
20
star
16

CameraDVR

DVR app for android.
Java
18
star
17

xiangqi

Chinese chess implemention
C
15
star
18

fftask

a simple rtos.
C
12
star
19

soundlink

C
12
star
20

ffeq

C
11
star
21

lxqchip8

chip8 & schip8 emulator
C++
8
star
22

dither

halftone image dither tool.
C
8
star
23

sngen

a des sn & key gen program
C
8
star
24

tpms

codes for TPMS (Tire Pressure Monitoring System)
Java
8
star
25

mp4muxer

C
8
star
26

fanplayer-binary

fanplayer binary release
C
7
star
27

ffpl0

Yacc
7
star
28

motiondet

a simple motion detection c language library.
C
7
star
29

ffencoder

a video recorder based on ffmpeg.
C
7
star
30

edog

C
5
star
31

mini2440-bsp

mini2440 android bsp
C
5
star
32

smartlink

C
5
star
33

swfloat

a software float point library
C
5
star
34

onvif-server

C
4
star
35

Isdbt

Isdbt TV player for android.
Java
4
star
36

mt7628_eeprom_tool

C
4
star
37

ffann

C
4
star
38

riscv32-test

C
3
star
39

mstar_model_convert

Python
3
star
40

ffyolodet

C++
3
star
41

FactoryTestNew

new factory test app for android device.
Java
3
star
42

barcode

C
3
star
43

ffrecorder

C
2
star
44

ffota

Java
2
star
45

sounddet

C
2
star
46

fighter

a windows console fighter game.
C
2
star
47

riscv32-toolchain

C
2
star
48

dossharelib

share lib for dos.
C
2
star
49

speextest

C
1
star
50

librtmp

C
1
star
51

android-avdev-test

android platform capture mic audio and capture screen.
C++
1
star
52

WiFiTest

an android wifitest app.
Java
1
star
53

DiskScanner

an example code for scaning disk file and displaying on activity.
Java
1
star
54

FactoryTest

android device fatory test tool.
Java
1
star
55

ffrge

C
1
star
56

ffrpg2

C
1
star
57

bmp24to32

C
1
star
58

ffmtcnn

C++
1
star
59

ultrafacedet

C++
1
star
60

SoundRecorder

wince sound recorder
C++
1
star
61

BatteryTest

a battery test tool for android
C
1
star
62

soundtouch

this project is fork of soundtouch for android platform.
C++
1
star
63

MediaCodecTest

android mediacodec test app.
Java
1
star
64

ffsnserver

C
1
star
65

ffhal

an android hal implemention.
C
1
star
66

libuvc

usb uvc camera
C
1
star
67

fanplayer-wince

port fanplayer to wince platform.
C
1
star