( AMB82 mini ) [Driver]: skb_unavailable=23 in last 2 seconds

All examples and code work fine, but I keep getting the following error message. This happens once every 2 seconds on the serial monitor.

[Driver]: skb_unavailable=27 in last 2 seconds

[Driver]: skb_unavailable=11 in last 2 seconds

[Driver]: skb_unavailable=2 in last 2 seconds

[Driver]: skb_unavailable=29 in last 2 seconds

[Driver]: skb_unavailable=2 in last 2 seconds

[Driver]: skb_unavailable=23 in last 2 seconds

[Driver]: skb_unavailable=27 in last 2 seconds

[Driver]: skb_unavailable=18 in last 2 seconds

[Driver]: skb_unavailable=29 in last 2 seconds

[Driver]: skb_unavailable=22 in last 2 seconds

[Driver]: skb_unavailable=15 in last 2 seconds

[Driver]: skb_unavailable=38 in last 2 seconds

[Driver]: skb_unavailable=28 in last 2 seconds

Hi @pcw0915,

You will see this warning from Driver as the application that you are running requires high throughput. However, it is fine to see this warning if it does not affect the performance of your application.

You will see this warning because the driver is waiting for an available socket buffer to store the next incoming packet. If too many packets are coming in (overloading), this warning will appear.

Do let us know again if it affects your application’s performance upon the appearance of this warning. I will feedback internally as well. Thank you!

Hi ia m getting this error - [INFO] Connect to Server successfully!

[Driver]: skb_unavailable=2 in last 2 seconds

line 781 file: D:/000_git_sd3/0_pro2_t/amebapro2/SDK_9.6/9.x/component/os/freertos/freertos_v202012.00/Source/queue.c

Hi @Naveen

May I know which example you are running that is causing this issue?

@pammyleong

#define CHANNEL 0
#define CHANNELJPEG 1

// ----------------- global variables------------------

uint32_t img_addr = 0;
uint32_t img_len = 0;

bool initialMessagesSent = false;
unsigned long connectionTime = 0;

VideoSetting configWS(VIDEO_HD, CAM_FPS, VIDEO_JPEG, 1);
VideoSetting config(CHANNEL);
RTSP rtsp;
StreamIO videoStreamer(1, 1);

int status = WL_IDLE_STATUS;
IPAddress ip;

WiFiClient wifiClient;

char serverAddress = “192.168.10.13”;
int wsPort = 6060;
// char endpoint = “/”;
char endpoint = “/?mac=00:1A:2B:3C:4D:5F”;
WebSocketClient wsClient = WebSocketClient(wifiClient, serverAddress, wsPort);

unsigned long lastSend = 0;
String receivedData = “”;
bool messageComplete = false;

//------------function declarations---------------

void videoStreamTask(void *pvParameters);
void webSocketTask(void *pvParameters);
void sendVideoFrame(void);
void processReceivedMessage(String message);
void sendAcknowledgement(String command, String requestId);

void setup()
{
Serial.begin(115200);

while (status != WL_CONNECTED)
{
    Serial.print("Connecting to: ");
    Serial.println(SECRET_SSID);
    status = WiFi.begin(SECRET_SSID, SECRET_PASS);
}
ip = WiFi.localIP();

Camera.configVideoChannel(CHANNEL, config);
Camera.configVideoChannel(CHANNELJPEG, configWS);
Camera.videoInit();

rtsp.configVideo(config);
rtsp.begin();

videoStreamer.registerInput(Camera.getStream(CHANNEL));
videoStreamer.registerOutput(rtsp);
if (videoStreamer.begin() != 0)
{
    Serial.println("StreamIO link start failed");
}

Camera.channelBegin(CHANNELJPEG);
Camera.channelBegin(CHANNEL);

// --------------Threads for tasks here -----------------

xTaskCreate(webSocketTask, "webSocketTask", 4096, NULL, 1, NULL);

xTaskCreate(videoStreamTask, "VideoStreamTask", 4096, NULL, 1, NULL);

}

void loop()
{

// blank loop

}

// WebSocket task function
void webSocketTask(void *pvParameters)
{
(void)pvParameters;

wsClient.begin(endpoint);

for (;;)
{
    if (!wsClient.connected())
    {
        wsClient.begin(endpoint);
        Serial.println("attempting to connect to server");
        vTaskDelay(pdMS_TO_TICKS(1000));
        initialMessagesSent = false;
        continue;
    }

    // Handle initial messages after connection
    if (!initialMessagesSent)
    {
        // Send first message immediately after connection
        String hello = "{\"message\":\"Hello from device\"}";
        wsClient.beginMessage(TYPE_TEXT);
        wsClient.print(hello);
        wsClient.endMessage();
        Serial.println("Sent: " + hello);
        delay(2000);

        String ready = "{\"status\":\"device ready\"}";
        wsClient.beginMessage(TYPE_TEXT);
        wsClient.print(ready);
        wsClient.endMessage();
        Serial.println("Sent: " + ready);

        connectionTime = millis();
        initialMessagesSent = true;
    }




    while (wsClient.connected())
    {
        char c = (char)wsClient.read();
        if (c == -1)
            break;

        receivedData += c;
        if (c == '}')
        {
            messageComplete = true;
        }

        if (messageComplete)
        {
            processReceivedMessage(receivedData);
            receivedData = "";
            messageComplete = false;
        }
    }
    vTaskDelay(pdMS_TO_TICKS(10));
}

}

void videoStreamTask(void *pvParameters)
{
(void)pvParameters;

for (;;)
{
    if (initialMessagesSent && wsClient.connected())
    {

        sendVideoFrame();
    }
    vTaskDelay(pdMS_TO_TICKS(66)); // ~15 fps
}

}

void processReceivedMessage(String message)
{
int jsonStart = message.indexOf(‘{’);
if (jsonStart != -1)
{
message = message.substring(jsonStart);
}

JsonDocument doc;
DeserializationError error = deserializeJson(doc, message);

if (error)
{
    Serial.println("Failed to parse JSON");
    Serial.println("Raw message: " + message);
    return;
}

const char *command = doc["command"];
const char *requestId = doc["requestId"];
sendAcknowledgement(command, requestId);

}

void sendAcknowledgement(String command, String requestId)
{

if (strcmp(command.c_str(), "open") == 0 || strcmp(command.c_str(), "close") == 0)
{
    String status = (command == "open") ? "opened" : "closed";
    String response = "{\"requestId\":\"" + requestId + "\",\"status\":\"" + status + "\",\"success\":true}";

    // Send acknowledgement
    wsClient.beginMessage(TYPE_TEXT);
    wsClient.print(response);
    wsClient.endMessage();

    Serial.print("Sent Acknowledgement: ");
    Serial.println(response);
}

}

void sendVideoFrame()
{
Serial.println(“Inside video Frame”);

Camera.getImage(CHANNELJPEG, &img_addr, &img_len);


if (img_len > 0) {
Serial.println("Inside image Condition");
Serial.println(img_len);


    wsClient.beginMessage(TYPE_BINARY);
    wsClient.write((uint8_t *)img_addr, img_len);
    wsClient.endMessage();
}

Serial.println("Image Sent");

}

----- I am trying to Image frames over websocket but i get that error after 14-15 frames are sent.-----

Hi @Naveen ,

If you are using applications that require high throughput, I suggest that you can use TCP instead of UDP.

Arduino SDK has not supported websocket yet.

If you would like to try out switching to TCP for video streaming to see the performance, you can do so by modifying in VLC.

hi @pammyleong I am able to use Websocket over the Http layer using ArduinoHttpclient and My WS client is also working perfectly it is just when i am sending the image frames continuously that errors pops in the serial monitor and everything stops working and also i want to send the streaming frames to a cloud server for hls conversion - suggest me if there is another way to do that - as http continous jpeg works fine from the example and i want to do the same just on websocket .

edit - i want to stream the video of my amb82 mini from internet basically.