ffmpeg streaming: udp vs. rtp when there are out of order packets.

 

[topology]

 

h1         s2

    \      /      \

      s1          s6 - h3

    /      \      /

h2         s3

 

h1 will use ffmpeg streaming with udp or rtp method to h3. The S1 will split the traffic 50% to S2 and 50% to S3. So the out of order packets may occur when h3 receives packets sent from h1.

 

[mininet script:2PATH.py]

#!/usr/bin/python

"""

Script created by VND - Visual Network Description (SDN version)

"""

from mininet.net import Mininet

from mininet.node import Controller, RemoteController, OVSKernelSwitch, OVSSwitch, UserSwitch

from mininet.link import Link, TCLink

from mininet.cli import CLI

from mininet.log import setLogLevel

def topology():

    "Create a network."

    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"

    h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' )

    h2 = net.addHost( 'h2', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )

    h3 = net.addHost( 'h3', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )

    s1 = net.addSwitch( 's1', protocols=["OpenFlow10,OpenFlow13"], listenPort=6674, mac='00:00:00:00:00:04' )

    s2 = net.addSwitch( 's2', protocols=["OpenFlow10,OpenFlow13"], listenPort=6675, mac='00:00:00:00:00:05' )

    s3 = net.addSwitch( 's3', protocols=["OpenFlow10,OpenFlow13"], listenPort=6676, mac='00:00:00:00:00:06' )

    s6 = net.addSwitch( 's6', protocols=["OpenFlow10,OpenFlow13"], listenPort=6679, mac='00:00:00:00:00:09' )

    c9 = net.addController( 'c9', controller=RemoteController, ip='127.0.0.1', port=6633  )

    print "*** Creating links"

    link1=dict(delay='1ms')

    net.addLink(h1, s1)

    net.addLink(h2, s1)

    net.addLink(s1, s2, cls=TCLink, **link1)

    net.addLink(s1, s3)

    net.addLink(s2, s6)

    net.addLink(s3, s6)

    net.addLink(s6, h3)

    print "*** Starting network"

    net.build()

    c9.start()

    s1.start( [c9] )

    s2.start( [c9] )

    s3.start( [c9] )

    s6.start( [c9] )

    print "*** Running CLI"

    CLI( net )

    print "*** Stopping network"

    net.stop()

if __name__ == '__main__':

    setLogLevel( 'info' )

    topology()

 

[scripts for the openvswitches:SC.sh]

ovs-ofctl -O OpenFlow13 add-group s1 group_id=0,type=select,bucket=weight:50,output=3,bucket=weight:50,output=4

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=4,ip,nw_dst=10.0.0.1,actions=output=1

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=4,ip,nw_dst=10.0.0.2,actions=output=2

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=4,dl_type=0x0806,actions=flood

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=1,actions=group=0

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=2,actions=output=3

ovs-ofctl -O OpenFlow13 add-flow s2 in_port=1,actions=output=2

ovs-ofctl -O OpenFlow13 add-flow s2 in_port=2,actions=output=1

ovs-ofctl -O OpenFlow13 add-flow s3 in_port=1,actions=output=2

ovs-ofctl -O OpenFlow13 add-flow s3 in_port=2,actions=output=1

ovs-ofctl -O OpenFlow13 add-flow s6 in_port=1,actions=output=3

ovs-ofctl -O OpenFlow13 add-flow s6 in_port=2,actions=output=3

ovs-ofctl -O OpenFlow13 add-flow s6 in_port=3,actions=output=2

 

[Execution]

Method 1. UDP streaming

 

 

 

UDP Streaming-> h1:sender, h3 receiver

 

 

Decode the received video into YUV format

 

Compare with the original YUV to get PSNR

The result is very bad.

We can also use ffplay to see the received video.

Because there is no sequence number information. The receiver cannot handle the out of order packets well.

 

RTP method

H1:sender, H3:receiver

 

 

It is better than UDP transmission method.

 

Note. When h1 is transmitting, the h3 can also use “ffplayi rtp://10.0.0.3:5003” to directly see the received results.

 

Dr. Chih-Heng Ke (smallko@gmail.com)

Department of Computer Science and Information Engineering,

National Quemoy University, Kinmen, Taiwan.