[NUT-devel] nut-np (nut based network protocol)

Michael Niedermayer michaelni at gmx.at
Mon Jun 26 14:05:37 CEST 2006


is there a non bloated non broken protocol around for streaming multimedia
over the net?
maybe we should invent one?

what about the following very simple one?

nut-np packet:
sequence_num                v
while(not end){
    type                    v
    if(type == 0){
        // one complete nut packet (main header, stream header, info packet,
        // syncpoint, normal packet)
        data                vb or raw?
    }else if(type == 1){         //nut packet fragment
        fragment_count      v    //whole number of fragments
        fragment_num        v    //which fragment we have here
        fragment            vb
    }else if(type == 2 || type == 3){ // acknowledge(2) / retransmit req(3)
        sequence_num_diff   v
    }else if(type == 4 || type == 5 ){//server side seek
        stream_id           v
        timestamp           v       // type=4 seek <=timestamp, type=5 >=
    }else if(type >=6 && type <=9){ // debug(6), warning(7)
                                    // error(8) (unsupported or failed command)
                                    // fatal(9) (cant recover / connection closed)
        sequence_num_diff   v    //sequence number this error referes to
        sub_seq_num         v    //which type+data part of the packet this refers to
        message             vb
    }else if(type == 10 || type == 11){ // discard stream flag
        stream_id           v    // type=10 -> dont send stream / type=11 send
    }else if(type==12){          // keyframe request
        stream_id           v
    }else if(type==13){          // set channel
        channel_id          v
    }else if(type==14){
        auto_retransmit_delay  v
    }else if(type==15){          // forward error correction
        sequence_num_diff   v    // the number of packets this covers
        ecc_type            v
        ecc                 vb or raw?

optional packets:
keyframe request, server side seek, set channel, auto_retransmit, forward
error correction

    MUST be 0, others are reserved

ecc (type 0)
    simply the interleaved XOR of the bits of all covered packets so a single
    lost packet can be recovered without retransmit

fragmentation stuff:
* the decoder is generally able to find the start of slices as they have
  startcodes so we dont need to take care of that
* the decoder can not use a slice if any part of that slice prior to it
  is missing
->encoders/nut-np servers should fragment packets so that the amount of
  data lost if a packet is lost, (that is everything inside that packet + 
  all parts of slices where a earlier part of that slice has been lost) 
  is minimized

duplicate packets
duplicate packets (same seq num) should be discarded and a acknowledge be sent

retransmits (in case a backchannel is available and the outer protocol is
* the server can optionally retransmit a packet if no acknowledge has been
  received within auto_retransmit_delay and the packet is important
  (a frame used as reference an error message or similar)
* the client and server MUST acknowledge important packets it received and
  ask for retransmits if something is missing and needed

in which outer layer protocol this all is used is outside the scope of this

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the NUT-devel mailing list