[libav-api] UDP Raw Video Streaming across a VLAN/SUBNET

Tim Visscher timvisscher95 at icloud.com
Mon Nov 13 13:18:54 CET 2017


Dear readers, 

I’m trying to create a cross platform mobile application (iOS and Android), that captures frames from the webcam, encodes them and streams them over UDP to a desktop application. 

I’ve tested my setup and programs and they work just fine when both of the devices stream and receiving are on the same VLAN/subnet. So I decided I would test the receiving end on a Windows PC which is connected by means of an ethernet cable, that unfortunately doesn’t work. The wired PC’s are on a different subnet then the Wi-Fi devices, but there’s sill connectivity between them.  

For example issuing a traceroute or a ping from a laptop connected to the Wi-Fi subnet (172.16.101.0/24) to a PC in the ethernet subnet (172.16.11.0/24):  
"traceroute -P ICMP -p 6005 172.16.11.102”, works just fine.

The stream is openend and used in an comparable manner to this; 

"
m_filename = "udp://172.16.11.102:6005”;
m_fmt_ctx = avformat_alloc_context();
m_fmt_ctx->oformat = m_fmt;
const char* cname = m_filename.toStdString().c_str();
strcpy(m_fmt_ctx->filename, cname);

// …

if (avio_open(&m_fmt_ctx->pb, m_filename.c_str(), AVIO_FLAG_WRITE) < 0) 
{
	/* HANDLE THE ERROR */
}

// write some packets and when we’re done call avio_close() and wrap up.

if (av_interleaved_write_frame(m_fmt_ctx, packet) < 0) 
{
	/* HANDLE THE ERROR */
}
“ 

The strange thing is when this code is in a “cross subnet” setup such as the example above that all the functions such as avio_open() and av_interleaved_write_frame() return 0, However there’s nothing actually being writing, I’ve confirmed this using Wireshark. 

Does anybody have an idea about what I might be doing wrong? 

Cheers,
Tim.


More information about the libav-api mailing list