OpenIPC / smolrtsp

A lightweight real-time streaming library for IP cameras
https://openipc.github.io/smolrtsp/
MIT License
251 stars 54 forks source link

bug in example #13

Closed chivstyle closed 1 year ago

chivstyle commented 1 year ago

smolrtsp is a great job. I tested on himix hi3559av100, it worked well.

I came across a segment fault, I modified the codes as below

static void Client_drop(VSelf) {
    VSELF(Client);
    /** If we disable audio or video, that means the according stream's context is NULL after a connection.
         It results in segment fault.
     */
    for (size_t i = 0; i < MAX_STREAMS; i++) {
        /** we should check the self->streams[i].ctx here, so
             if (self->streams[i].ctx.ptr) {
                 VCALL(...) 
            }
           */
        VCALL(self->streams[i].ctx, drop);
    }

    free(self);
}