- Tue Aug 25, 2015 7:28 pm
#27046
I am creating a home automation base station with an ESP8266 chip using IoT SDK. I have the chip connecting to the IP Camera via TCP, calling DESCRIBE/SETUP/PLAY and opening a UDP server for the camera to dump data. This data is then inserted into a 15-20 capacity of 1500 character circular buffer, which is pushing this data to an iPhone via TCP. The I-Frame of my camera on lowest quality and lowest resolution is 1450 bytes * 5 packets, followed by 50 or so P-Frames which are only 200-500 bytes * 1 packet. The problem I am having is when the ESP8266 receives an I-Frame, it quickly fills up the buffer and most of the time to full (with following P-Frames) and sometimes will begin sending the packets off and sometimes won't send any more packets at all. I am guessing the problem is because it is receiving so much data that it does not have time to send the packet before the next camera frame is received? I was thinking maybe using multithreading with tasks on RTOS may be better? Having one thread to receive the data via UDP and placing the data on the buffer, while another thread pulls the data off the buffer and sends via TCP? What is strange is if I call the set_opt function with the COPY command and setup the callback command for write_finished, it says the write is finished right after the espconn_sent command is issued. But the espconn_sent cb function does not get called for quite a while. Could this be a bug or is the data just overloading the ESP8266? Would RTOS SDK solve this problem? Thanks.