UDP packet loss when transimitt video

roctwo
Posts: 95
Joined: Mon Nov 28, 2016 3:12 am

UDP packet loss when transimitt video

Postby roctwo » Wed Feb 15, 2017 8:39 am

Hi!
The following is my code:

Code: Select all

static void udp_thread(void *p)
{
int i = 0;
int sock;
struct sockaddr_in toAddr;
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, false, true, portMAX_DELAY);
LWIP_UNUSED_ARG(p);
sock = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if(sock < 0)
{
ESP_LOGI(TAG, "socket err");
}
memset(&toAddr,0,sizeof(toAddr));
toAddr.sin_family=AF_INET;
toAddr.sin_addr.s_addr=inet_addr("192.168.10.9");
toAddr.sin_port = htons(REMOTE_PORT);
while(1) 
{
sendto(sock,start,SEND_START_LEN,0,(struct sockaddr*)&toAddr,sizeof(toAddr));
for(i=0; i<240; i++)
{
sendto(sock,image1+i*480,SEND_BUF_LEN,0,(struct sockaddr*)&toAddr,sizeof(toAddr));
}
sendto(sock,end,SEND_END_LEN,0,(struct sockaddr*)&toAddr,sizeof(toAddr));
}
close(sock);
vTaskDelete(NULL);
}
I use Wifi LAN for transmission.According my test,UDP packet loss is very serious.I would like to ask what is the cause of UDP packet loss serious.What advice do you have for video transmission using ESP32.Faster transmission requirements.And is there sample code for transmitting video via wifi.

Who is online

Users browsing this forum: No registered users and 109 guests